-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 According to Eric Blake on 11/18/2008 6:56 PM: >> Hmm. This exposes it: > >> $ sh -ec 'trap '\''echo $?'\'' 0; false;' >> 0 > >> But at the same time: >> $ sh -c 'set -e; trap '\''echo $?'\'' 0; false;' >> 1 > >> Weird.
Is it indeed the status of the command prior to the one that triggers the errexit? For example, what happens on: $ sh -ec 'trap '\''echo $?'\'' 0; : && (exit 2); echo a; : && (exit 3); false; echo b' If it shares the pdksh bug where ': && (exit 2)' triggers errexit, even though it is a list and not a simple command, then the trap executes prior to the 'echo a', but does that result in 0 or 2? If it is like bash, then the 'echo a' will execute, but do we see 0 or 3? Finally, if the 'echo b' executes, then something is seriously broken with the 'set -e' implementation. - -- Don't work too hard, make some time for fun as well! Eric Blake [EMAIL PROTECTED] -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (Cygwin) Comment: Public key at home.comcast.net/~ericblake/eblake.gpg Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iEYEARECAAYFAkkjdUgACgkQ84KuGfSFAYAFdwCdEf4I2thHFpUXE0U0DwsbvTUO GmkAn1UWILXoDlkHsdVRYCxY8i27D/RF =7x8n -----END PGP SIGNATURE-----
