[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:58:01 -0400 |
User-agent: |
Mutt/1.4.2.3i |
On Mon, Apr 06, 2015 at 10:31:49AM -0500, Eduardo A. Bustamante López wrote:
> dualbus@yaqui ~ % bash -c 'trap "echo bar" DEBUG; source /dev/fd/0; :' <<<
> 'trap "echo foo" DEBUG; :'
> bar
> foo
> bar
>
> Here, the first `bar' is executed before `source'. Then, we enter a new
> `scope', or whatever this is called. Then, there's `foo', due to the `:'
> called
> inside the sourced script. After we `return' from the sourced script, `bar' is
> written, before the `:' from the main script (the -c one).
>
> So, essentially, we have two DEBUG traps set at the same time, living in
> different scopes. (DEBUG, RETURN and ERR are the only ones special here, I
> think).
I'd be fine with that, but then why does "source ./foo" create a DEBUG
trap at the global scope the *first* time?
- Second trap invocation is ignored?, Scott Bronson, 2015/04/05
- 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 <=
- Re: Second trap invocation is ignored?, Chet Ramey, 2015/04/10
- Re: Second trap invocation is ignored?, Scott Bronson, 2015/04/10
- Re: Second trap invocation is ignored?, Chet Ramey, 2015/04/11
Re: Second trap invocation is ignored?, Scott Bronson, 2015/04/06
Re: Second trap invocation is ignored?, Chet Ramey, 2015/04/10