4 ms·
Lots of arguments against not using set -euo pipefail https://www.reddit.com/r/commandline/comments/g1vsxk/comment/fniifmk/ https://www.reddit.com/r/commandline
by vivzkestrel 1y ago
Lots of arguments against not using set -euo pipefail https://www.reddit.com/r/commandline/comments/g1vsxk/comment/fniifmk/ https://www.reddit.com/r/commandline/comments/g1vsxk/comment... anything you wanna say about this?
- awestroke 1y agoeuo pipefail has been the one good thing with bash. I'll start looking at alternatives now
- jacob2161 1y agoThat post is quite nitpicky, pointing to edge cases and old version behavior. The essence of it is that writing reliable Bash scripts requires significant domain knowledge, which is true. Bash scripts are great if you've been doing it for a very long time or you're doing something simple and small (<50 LOC). If it's complicated or large, you should just write it in a proper programming language anyway.
- heresie-dabord 1y ago> something simple and small (<50 LOC). If it's complicated or large, you should just write it in a proper programming language anyway. Regardless of LOC, eject from bash/awk as soon as you need a data structure, and choose a better language.
- jacob2161 1y agoYeah, that's a good point. It's less about LOC than complexity (data structures, complicated string parsing, handling binary data, etc). And that's actually the advice I follow myself. Some longish Bash scripts are very maintainable and reliable, because they're still quite regular and simple.