1 Nov
2009
1 Nov
'09
7 p.m.
On Sun, Nov 01, 2009 at 05:45:27PM +0000, Cedric Staniewski wrote:
Allan McRae wrote:
From bash's manpage:
trap [-lp] [[arg] sigspec ...] [...] The ERR trap is not executed if the failed command is part of the command list immediately following a while or until keyword, part of the test in an if statement, part of a command executed in a && or || list, or if the command's return value is being inverted via !.
Note that apparently only the test/[ builtin is meant here.
I get the same results with both test/[ as with [[ Reusing your code,
set -E trap 'echo >&2 "error"' ERR
false [ false ] [[ false ]] (( 0 )) ! true
Only the 'false' by itself triggers the trap. [ and [[ and treated the same.