5 ms·
That's orthogonal to the article - in fact, the article hints that you'd take this advice when your bash script is failing midway, such as it might with `set -e
by dymk 7y ago
That's orthogonal to the article - in fact, the article hints that you'd take this advice when your bash script is failing midway, such as it might with `set -e`.
The article is about writing bash scripts that don't care if you've ran them once, or 10 times.
- unixhero 7y agoPrecisely.
- farslan 7y agoOp here. Exactly this. I’ve seen many times where people had scripts and had to modify it (such as commenting code) when something has failed in the middle of the script.
- snissn 7y agoDon't forget about pipefail!! set -eu set -o pipefail Anything else I'm missing?
- khc 7y agonounset
- richardwhiuk 7y ago`set -x` can be very useful.
- jaytaylor 7y agoIIRC, `set -o nounset` is the bash equivalent for `set -u` in sh.
- news_hacker 7y agoSeems like all the pedants came out for this article. In good-faith I understand the principles OP is suggesting and have first-hand experience of their usefulness. But it's easier to nit-pick I guess.
- dredmorbius 7y agoThis is a case where the pedents should at least be considered.
- unixhero 7y agoEverytime I discuss Bash on the net, these gremlin style characters ruin the fruitful discussions I've had ... I think the article provides excellent advice.
- rhizome 7y ago>The article is about writing bash scripts that don't care if you've ran them once, or 10 times. Is the idea that participants don't know what "idempotent" means in a thread with that word in the title?