Can anyone explain this behavior (FreeBSD 9.0-RC3 amd64):

Script:
----
#!/bin/sh

cleanup()
{
    echo 'first'
    echo 'second'
}

fail() { return 42; }

trap cleanup EXIT
set -o errexit
fail
----

Output:
----
first
----

Now comment out 'set -o errexit', replace 'fail' with 'fail || exit'
(which should be equivalent to using errexit), and run again.

Output:
----
first
second
----

Am I doing something stupid or is this a bug? Bash prints out the same
(second) output for both versions of the code.

- Max
_______________________________________________
[email protected] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "[email protected]"

Reply via email to