-
-
Latest Posts
Archives
Tags for this category
Recently Played Games
Tag Archives: .bash_profile
Pipe failed…?
There are times when you want to monitor the exit status through a whole pipeline of chained commands. But the default behavior of Bash is to show the exit status of the right-most (last) command in the pipe. This can a problem, specifically in scripting.
I prefer if the pipeline’s return status is the value of the last (rightmost) command to exit with a non-zero status, OR zero if all commands in the pipeline exit successfully.
This can be achieved by adding the following line to your script:
set -o pipefail
This can also be added to your ~/.bash_profile to make the change permanent.
Posted in Linux
Tagged .bash_profile, 2011, bash, exit status, linux, option, pipe, pipefail, set
Leave a comment