3 ms·
Except `set -e` is stupid because it is disabled all the way down when a command occurs in a conditional, meaning this: function foo { false; true; } foo |
by cryptonector 6y ago
Except `set -e` is stupid because it is disabled all the way down when a command occurs in a conditional, meaning this:
function foo { false; true; }
foo || echo foo failed
prints nothing!
From the bash manual page:
| If a compound command other than a subshell returns a non-zero status because a command failed while -e was being ignored, the shell does not exit.
POSIX says the same thing, so this is true of all POSIX-y shells.
This means you really have to check for errors you care about, and `set -e` is useless. Ugh!