On Mon, Apr 06, 2015 at 10:04:12AM -0500, Eduardo A. Bustamante López wrote:
> The `script2' I provided ran with set -T is the closest you'll get to what you
> expect, but, since DEBUG runs *before* the source command, it'll not work as
> you want.

It doesn't matter whether the old DEBUG trap runs before or after the
new trap is defined.  It's not about the output.  That's a red herring.
The problem is the second trap definition *does not stick*.

imadev:~$ echo 'trap ": one" DEBUG' > foo
imadev:~$ echo 'trap ": two" DEBUG' > bar
imadev:~$ trap - DEBUG
imadev:~$ source ./foo
imadev:~$ source ./bar
imadev:~$ trap -p DEBUG
trap -- ': one' DEBUG

It's still got the first definition, not the second one.

Reply via email to