bug-bash
[Top][All Lists]
Advanced

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

Re: Second trap invocation is ignored?


From: Greg Wooledge
Subject: Re: Second trap invocation is ignored?
Date: Mon, 6 Apr 2015 11:10:55 -0400
User-agent: Mutt/1.4.2.3i

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

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