-
-
Save donnoman/107302 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# How to exit if any command in a bash subshell fails with piping all output | |
set -o pipefail | |
( | |
set -o errexit; | |
echo -n "T"; | |
# false; | |
echo -n "e"; | |
# false; | |
echo -n "s"; | |
false; | |
echo -n "t"; | |
# false; | |
) 2>&1 | cat | |
subshell_rv=$? | |
echo " " | |
echo "Returned subshell_rv: $subshell_rv" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment