|
|
|
|
|
by bombcar
1567 days ago
|
|
See https://mywiki.wooledge.org/BashFAQ/105 for examples of side effects. I think the idea is you use set -e during development to find where you should catch errors, but in production you may want it off to reduce strange side-effects (or explicitly check for success in the way you expect; so not that the command returned 0 but that the file it made exists and is the right length, etc). |
|
Having -e set is to reduce strange side-effects, by having the script fail, instead of plowing headlong into the land of undefined/unexpected behavior.
> See https://mywiki.wooledge.org/BashFAQ/105 for examples of side effects.
The `if` bit should be well-known if you're writing bash. The pipe bit is unfortunate, and is why -o pipefail is recommended, too. Or, just writing in a sane language that isn't going to page you in the middle of the night.