You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Here are some "positive" or at least not negative examples suggesting using it (in a simple manner), but I think trap and explicit error handling is far better than hoping set -e saves you.
I have since been educated a little more in how set -e can be useful, but having set -o pipefail and potentially adding a good basic trap aTrapFunction ERR could also be useful to provide some output to the user/script writer when they trigger the -e and it exits.
Articles questioning its use and highlighting the MANY pitfalls of using it:
http://mywiki.wooledge.org/BashFAQ/105
Specifically many of the examples:
http://mywiki.wooledge.org/BashFAQ/105#Exercises
The list of caveats is a mile long:
http://fvue.nl/wiki/Bash:_Error_handling
Here are some "positive" or at least not negative examples suggesting using it (in a simple manner), but I think
trap
and explicit error handling is far better than hopingset -e
saves you.https://www.davidpashley.com/articles/writing-robust-shell-scripts/#id2596016 http://redsymbol.net/articles/unofficial-bash-strict-mode/
The text was updated successfully, but these errors were encountered: