[u-u] wow, post-tested loops in sh

Alan J Rosenthal flaps at 56789.ca
Mon Jul 4 13:20:01 EDT 2016

>(To make bash less forgiving of mistakes, I always put "set -eu" early
>in my scripts.  Forgiveness is not always a blessing.)

I keep telling my classes that error messages are good (e.g. suppressing
them with unnecessary casts is bad).  *Errors* are bad, and they associate
error messages with errors; but it's actually the other way around in
that error MESSAGES enable you to FIX errors, so they're good.

"set -e" can be weird, though.  One weirdness is that statements like

	z=`expr $x + $y`

fail randomly -- expr (bizarrely imho) yields a failure exit status when
the sum is zero.

More fundamentally, "set -e" doesn't generate any additional error messages,
so it's not really in the same class as things like "set -u".


More information about the u-u mailing list