Reputation: 453
Being trying to properly guard for non-zero exits on a bash script.
What is the difference between -e, -u and -o pipefail?
-o pipefail is not sufficient to exit with an error code?
Upvotes: 5
Views: 2857
Reputation: 546
set -e
: Exit immediately if a command exits with a non-zero status.
set -u
: If you try to access an undefined variable, that is an error.
set -o pipefail
: If any command in a pipeline returns a non-zero exit code, the return code of the entire pipeline is the exit code of the last failed command.
Upvotes: 8