diff options
Diffstat (limited to 'repo.sh')
-rwxr-xr-x | repo.sh | 33 |
1 files changed, 33 insertions, 0 deletions
@@ -0,0 +1,33 @@ +#!/bin/sh +set -eu + +f() { + set -e + bad-command + unreachable + return 0 +} + +f && echo 'Executed, but shoult not' + +if f; then + echo 'Also executed, but should not' +fi + +f || echo 'Not executed, but should be' + +if ! f; then + echo 'Also not executed, but should be' +fi + +set -x +set +e +f +STATUS=$? +set -e +if [ "$STATUS" != 0 ]; then + echo 'Only one that is executed when it should be' +fi + +f +echo 'This is *actually* unreachable' |