Skip to content

Instantly share code, notes, and snippets.

@mgpld
Created January 14, 2012 14:13
Show Gist options
  • Save mgpld/1611618 to your computer and use it in GitHub Desktop.
Save mgpld/1611618 to your computer and use it in GitHub Desktop.
Detecting failure in piped commands (bash)
# By default the failure is note detected:
set -o | grep pipefail
pipefail off
No manual entry for fear
echo $?
0
# Detecting the failure
set -o pipefail
man fear | tee
No manual entry for fear
echo $?
16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment