bug-bash
[Top][All Lists]
Advanced

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

Second trap invocation is ignored?


From: Scott Bronson
Subject: Second trap invocation is ignored?
Date: Sun, 5 Apr 2015 09:39:50 -0700

Hi, I don't understand the behavior of the trap command...

   echo '
         trap "echo $1" DEBUG
      ' > ./trapcmd

   source ./trapcmd first
   source ./trapcmd second

I would expect the debug trap to now be 'echo second'.
However, it's still 'echo first' (full output below).

Why is the second invocation ignored?  Maybe a bug?

I see this behavior on 3.2.57 and 4.2.45.  Thanks,

    - Scott


Example run:

~$    echo 'trap "echo $1" DEBUG' > trapcmd
~$    source ./trapcmd first
first
first
~$    source ./trapcmd second
first
first
first
~$ trap -p
first
trap -- 'echo first' DEBUG
first
first
~$



reply via email to

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