bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

BASH_COMMAND is incorrect when working with subshells and error traps


From: Mike Frysinger
Subject: BASH_COMMAND is incorrect when working with subshells and error traps
Date: Wed, 22 Aug 2012 12:30:11 -0400
User-agent: KMail/1.13.7 (Linux/3.5.0; KDE/4.6.5; x86_64; ; )

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

Attachment: signature.asc
Description: This is a digitally signed message part.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]