[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
~$
- Second trap invocation is ignored?,
Scott Bronson <=
- Re: Second trap invocation is ignored?, Greg Wooledge, 2015/04/06
- Re: Second trap invocation is ignored?, Eduardo A . Bustamante López, 2015/04/06
- Re: Second trap invocation is ignored?, Scott Bronson, 2015/04/06
- Re: Second trap invocation is ignored?, Eduardo A . Bustamante López, 2015/04/06
- Re: Second trap invocation is ignored?, Greg Wooledge, 2015/04/06
- Re: Second trap invocation is ignored?, Scott Bronson, 2015/04/06
- Re: Second trap invocation is ignored?, Eduardo A . Bustamante López, 2015/04/06
- Re: Second trap invocation is ignored?, Greg Wooledge, 2015/04/06
- Re: Second trap invocation is ignored?, Chet Ramey, 2015/04/10
- Re: Second trap invocation is ignored?, Scott Bronson, 2015/04/10