-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 According to David Arnstein on 5/14/2008 6:36 PM: | #!/bin/bash | trap "echo '<aborting>' ; exit 1" ERR | grep -q -e 'foo' < /dev/null | | This indicates that grep has raised the signal ERR.
There is no such thing as signal ERR. Rather, ERR is a special case to the trap command that means the trap is executed when any simple command returns non-zero status (in the same cases that set -e would cause the shell to exit). 'man bash' explains this in more detail. | grep -q -e 'foo' < /dev/null | is NOT aborting my shell script. It simply returns status 1, which I | do NOT want to handle by calling exit. Then don't trap ERR, or else write your script to handle expected non-zero status. For example, ~ grep -q -e 'foo' < /dev/null || : is not a simple command (it uses ||), so it won't trigger the ERR trap nor cause a 'set -e' shell to exit. By the way, none of this is cygwin specific. - -- Don't work too hard, make some time for fun as well! Eric Blake [EMAIL PROTECTED] volunteer cygwin bash maintainer -----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 iEYEARECAAYFAkgrht4ACgkQ84KuGfSFAYC5/ACgxQCwU3UYiF8AovxrOowF/qTC 0UAAniPYYzMBDdpBJTLlySGupx28drAq =31ss -----END PGP SIGNATURE----- -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/