Created
June 6, 2015 20:12
-
-
Save benaryorg/296386f05b12de599161 to your computer and use it in GitHub Desktop.
shell chaos
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 | |
trap '[ '$?' -ne 77 ] || exit 77' ERR | |
$(echo '$(exit 11)';exit 11) | |
(echo '(exit 11)';exit 11) | |
$(echo '$(exit 77)';exit 77) | |
(echo '(exit 77)';exit 77) | |
echo 'exit 0';exit 0 | |
echo 'not to be printed' |
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
$ ./test1.sh | |
./test1.sh: line 6: $(exit: command not found | |
(exit 11) | |
./test1.sh: line 10: $(exit: command not found | |
(exit 77) | |
exit 0 |
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 | |
trap '[ '$?' -ne 77 ] || exit 77' ERR | |
$(exit 11) | |
echo '$(exit 11)' | |
(exit 11) | |
echo '(exit 11)' | |
$(exit 77) | |
echo '$(exit 77)' | |
(exit 77) | |
echo '(exit 77)' | |
echo 'exit 0' | |
exit 0 | |
echo 'not to be printed' |
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
$ ./test2.sh | |
$(exit 11) | |
(exit 11) | |
$(exit 77) | |
(exit 77) | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment