DencklaTronic
21 April 2011
bash pipefail
If you care about the exit code of a piped bash command, you must set the "pipefail" option. The code below shows this.
Output:
false alone: 1
false piped to head: 0
false 'pipefailed' to head: 1
The "take home" message from this is that you should always set the pipefail option. Too bad it is not the default.
Below are links to some other sites on this topic.
pipefail – testing pipeline exit code
pipefail
No comments:
Post a Comment
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment