Why doesn't Bash’s ‘set -e’ do what I expected? (2021)
Shell scripts can be thought like C++. They can be sanely managed only if one adopts a strict subset of functionalities.<p>The page is probably oriented at situations where one needs to support any version of bash and any obscure&#x2F;inadvisable functionality (mind that there are still devs that mix sh and bash syntax in the same script), which is very inconvenient and error prone, so manual error handling <i>may</i> make sense.<p>While there is always something insane behind the corner in Bash, with a restricted subdomain (e.g. bash 4.2+, strict shell options, and shellcheck) it&#x27;s possible to progressively write reasonably solid shell scripts.<p>The document conclusion is somewhat biased. &quot;to handle errors properly&quot; implies that `-e` in inherently unreliable, which not fair - strict shell options do remove certain classes of errors, which doesn&#x27;t hurt.