There are three scripts:
good.sh
exits successfullymaybe.sh
contains a failing command, but its last command succeeds, so the whole script exits successfullybad.sh
addsset -e
tomaybe.sh
, causing the script to fail after the first failing command
The Makefile targets of good, bad, and ugly depend on those scripts. Note that good and ugly succeed while bad fails.
The targets of good-dep, bad-dep, and ugly-dep depend on the above targets. Again, good-dep and ugly-dep succeed, and the additional rules run. bad-dep stops after running bad, since it failed.
The good-bad and bad-good targets run the good.sh
and bad.sh
scripts in opposite orders. Both stop after running the bad
script, and both fail.
The good-bad-dep and bad-good-dep depend on both good and bad, in opposite orders. The dependent commands are run in the order listed, and execution ends after running bad. Both fail, and neither runs its own code.