bash-util/errhandl.bash
Andrew Rogers 64066d0172 Added unhappy_ending to happy wrappy
Now happy prints the command line that failed before exiting!
2023-05-04 14:38:30 -05:00

7 lines
212 B
Bash

# 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 $? $@; }