[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: BASH_COMMAND is incorrect when working with subshells and error trap
From: |
Mike Frysinger |
Subject: |
Re: BASH_COMMAND is incorrect when working with subshells and error traps |
Date: |
Wed, 22 Aug 2012 15:35:12 -0400 |
User-agent: |
KMail/1.13.7 (Linux/3.5.0; KDE/4.6.5; x86_64; ; ) |
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 would not be ambiguous,
but forgot to post the updated shell script.
#!/bin/bash
trap 'echo $BASH_COMMAND; exit 1' ERR
set -e
true 1
(false)
true 2
-mike
signature.asc
Description: This is a digitally signed message part.