Denys Vlasenko | 6696eac | 2010-11-14 02:01:50 +0100 | [diff] [blame^] | 1 | echo Default: |
| 2 | echo "true | true:" |
| 3 | true | true; echo $? |
| 4 | ! true | true; echo $? |
| 5 | echo "true | false:" |
| 6 | true | false; echo $? |
| 7 | ! true | false; echo $? |
| 8 | echo "false | true:" |
| 9 | false | true; echo $? |
| 10 | ! false | true; echo $? |
| 11 | echo "exit 2 | exit 3 | exit 4:" |
| 12 | exit 2 | exit 3 | exit 4; echo $? |
| 13 | ! exit 2 | exit 3 | exit 4; echo $? |
| 14 | |
| 15 | echo Pipefail on: |
| 16 | set -o pipefail |
| 17 | echo "true | true:" |
| 18 | true | true; echo $? |
| 19 | ! true | true; echo $? |
| 20 | echo "true | false:" |
| 21 | true | false; echo $? |
| 22 | ! true | false; echo $? |
| 23 | echo "false | true:" |
| 24 | false | true; echo $? |
| 25 | ! false | true; echo $? |
| 26 | echo "exit 2 | exit 3 | exit 4:" |
| 27 | exit 2 | exit 3 | exit 4; echo $? |
| 28 | ! exit 2 | exit 3 | exit 4; echo $? |
| 29 | |
| 30 | echo Pipefail off: |
| 31 | set +o pipefail |
| 32 | echo "true | true:" |
| 33 | true | true; echo $? |
| 34 | ! true | true; echo $? |
| 35 | echo "true | false:" |
| 36 | true | false; echo $? |
| 37 | ! true | false; echo $? |
| 38 | echo "false | true:" |
| 39 | false | true; echo $? |
| 40 | ! false | true; echo $? |
| 41 | echo "exit 2 | exit 3 | exit 4:" |
| 42 | exit 2 | exit 3 | exit 4; echo $? |
| 43 | ! exit 2 | exit 3 | exit 4; echo $? |
| 44 | |
| 45 | echo Done |