Created
November 2, 2014 19:32
-
-
Save tlunter/408dbac860e883156d82 to your computer and use it in GitHub Desktop.
The output of $test changes whether or not the bash grouping is piped into another command or not.
This file contains 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 | |
set -e -o pipefail | |
test=1 | |
{ echo "test"; echo "test2" && test=0; } | cat > /dev/null | |
echo "$test" | |
test=1 | |
{ echo "test"; echo "test2" && test=0; } > /dev/null | |
echo "$test" | |
# $ ./test.sh | |
# 1 | |
# 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment