bash-util/errhandl.bash

8 lines
212 B
Bash
Raw Permalink Normal View History

2023-02-22 21:41:54 -06:00
# Don't want subsequent commands to run after nonzero exit? Wrappy in happy!
unhappy_ending() {
stat=$1; shift
(echo "Error while running: \"$@\"" >&2)
exit $stat
}
happy() { $@ || unhappy_ending $? $@; }