4 ms·
set -e is not great and is not recommended. http://mywiki.wooledge.org/BashFAQ/105 http://mywiki.wooledge.org/BashFAQ/105
by Siecje 6y ago
set -e is not great and is not recommended. http://mywiki.wooledge.org/BashFAQ/105 http://mywiki.wooledge.org/BashFAQ/105
- joseluisq 6y agoAgree with the "false positives" however in combination with error handling I don't see why not use it.
- _jal 6y ago-e is in the class of things that can be fine to use, but the people least-likely to be prepared to know when it can be are the most likely to expect it to behave better than it does. Sort of a combination finger-trap/cigar cutter for newbies.
- rgoulter 6y agoI read this as "bash has unintuitive footguns" rather than "set -e has unintuitive footguns with its usage".
- oblio 6y agoBash doesn't have unintuitive footguns, bash <<is>> a unintuitive footgun :-)
- t0astbread 6y agoI agree with the second to last recommendation: > rking's personal recommendation is to go ahead and use set -e, but beware of possible gotchas. It has useful semantics, so to exclude it from the toolbox is to give into FUD. Manual error handling would be ideal but it's too easy for me to mess up and miss something. Plus, if you really wanted to catch everything with proper error handling you would need to wrap every command in your script.