|
|
|
|
|
by hannibalhorn
770 days ago
|
|
That's an interesting link and an argument I hadn't seen before. In my "real world" usage, I've found "bash strict mode" incredibly useful, especially when scripting things that others will be modifying. It just avoids all of the "somebody forgot an error check", "there's a typo in a variable name", etc., type errors. And pouring through logs to figure out what actually went wrong in CI/CD is brutal. Looking at the examples: - I don't generally do arithmetic in bash, that's a sign of "time to change language"
- Also generally use `if ...; then ...; fi` instead of `test ... && ...` If you do the advanced type of scripting that somebody who writes a Bash FAQ does, I'm sure `set -e` can be annoying. But once you learn a couple simple idioms y(covered on the original "bash strict mode" page) you don't have to know much more to have fairly robust scripts. And future maintainers will thank you for it! |
|