Re: BASH_COMMAND is incorrect when working with subshells and error traps

2012-08-22 Thread Chet Ramey
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 8/22/12 3:35 PM, Mike Frysinger wrote: > On Wednesday 22 August 2012 12:30:11 Mike Frysinger wrote: >> consider this simple code: >> >> $ cat test.sh >> #!/bin/bash >> trap 'echo $BASH_COMMAND; exit 1' ERR >> set -e >> true >> (false) >> true >> >>

Re: BASH_COMMAND is incorrect when working with subshells and error traps

2012-08-22 Thread Mike Frysinger
On Wednesday 22 August 2012 12:30:11 Mike Frysinger wrote: > consider this simple code: > > $ cat test.sh > #!/bin/bash > trap 'echo $BASH_COMMAND; exit 1' ERR > set -e > true > (false) > true > > when run, we see: > $ ./test.sh > true 1 err, i tweaked my shell script slightly so this output wou

BASH_COMMAND is incorrect when working with subshells and error traps

2012-08-22 Thread Mike Frysinger
consider this simple code: $ cat test.sh #!/bin/bash trap 'echo $BASH_COMMAND; exit 1' ERR set -e true (false) true when run, we see: $ ./test.sh true 1 this can be confusing when utilized with automatic backtraces :( even when using errtrace and debugtrace, BASH_COMMAND is incorrect -mike si