So how do we do this in Bash? Well this type of thing pops up fairly regularly:
mycommandhere if [ "$?" -ne "0" ]; then echo $cmd " failed :(" exit 1; fiYou can use A || B to chain things on failure (if A succeeds B doesn't execute) ... so why don't people do this:
mycommandthatmightfail || (echo "informativeness!"; exit 1)Note that as we used ; to separate the commands to run if mycommandthatmightfail does indeed fail they will all run even if some of them fail.