> E If set, any trap on ERR is inherited by shell functions, command substitutions, and commands executed in a subshell environment. The ERR trap is normally not inherited in such cases.
set -eu is at least 30 years old. Not sure whether it makes sense to rewrite established code.
You're missing `errtrace` (-E) which means "any trap on ERR is inherited by shell functions, command substitutions, and commands executed in a subshell environment"
You probably haven't used it much if you haven't been using `trap`
I often set up a temporary directory at the beginning and then clean it up in an EXIT trap. Adding ERR and errtrace (-E) would remove the tmpdir or the first failure anywhere, no matter if it's a recoverable one.
So I'm sticking with just set -eu and trap EXIT...
Yes! I read this somewhere a little while back and have been doing it exclusively since. Makes tons of sense.
Usually I have to look up what the long options are, since I've generally only memorized the short ones, but it helps immensely with readability, particularly for someone who hasn't memorized the short ones, who can now just semantically understand the options.