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