diff --git a/errhandl.bash b/errhandl.bash index 816b432..3e4d18b 100644 --- a/errhandl.bash +++ b/errhandl.bash @@ -1,2 +1,7 @@ # Don't want subsequent commands to run after nonzero exit? Wrappy in happy! -happy() { $@ || exit $?; } +unhappy_ending() { + stat=$1; shift + (echo "Error while running: \"$@\"" >&2) + exit $stat +} +happy() { $@ || unhappy_ending $? $@; }