Skip to content

Latest commit

 

History

History
31 lines (22 loc) · 1020 Bytes

pipefail.md

File metadata and controls

31 lines (22 loc) · 1020 Bytes

Pipefail option

  • set -o pipefail
  • BASH normally only looks at the exit code of the last command of a pipeline
  • This behavior is not ideal as it causes the -e option to only be able to act on the exit code of a pipeline’s last command
  • This particular option sets the exit code of a pipeline to that of the rightmost command to exit with a non-zero status, or to zero if all commands of the pipeline exit successfully.

#### Without Pipefail

filename

bash ./examples/options/options_without_pipefail.sh
echo $?

#### With Pipefail

filename

bash ./examples/options/options_with_pipefail.sh
echo $?






### References