3 ms·
It's good practice to include set -eu set -o pipefail to avoid the default ON ERROR RESUME NEXT behaviour of bash.
by coherentpony 10y ago
It's good practice to include
set -eu
set -o pipefail
to avoid the default ON ERROR RESUME NEXT behaviour of bash.
- stonogo 10y agoPlease stop with the cargo-cult shell scripting. That's not all those options do.
- Someone1234 10y agoPerhaps an explanation would have been more constructive than an insult.
- stonogo 10y agoYes, I owe an explanation, but the guy advocating pasting bash settings into every script doesn't.
- coldtea 10y agoHe gave an explanation of what they do. It might be wrong, but you haven't given any alternative one. Besides he is right, and those are useful additions to almost any script that you want to stop on error, undefined vars, etc.
- Macha 10y agoIs that behaviour not the point here? The script tries the first command,then the second if that fails,etc.
- _asummers 10y agoOne should also create traps on exit, to revert the system to a good state in the event of pipefail.