2014-03-19 09:51:06 -0400, Chet Ramey:
[...]
> This is another instance of the question "what does bash do with a SIGINT
> it receives while waiting for a foreground process?"  The answer is that it
> allows the child to decide what to do and responds accordingly: if the
> child exits due to being killed by the SIGINT, bash acts as if it received
> the SIGINT; if the child decides to trap it, do something else and not
> resend the SIGINT to itself, bash will effectively discard it.  In any
> case, bash doesn't do anything until the child exits.
> 
> There is a fairly long explanation of the issue at
> http://www.cons.org/cracauer/sigint.html.
[...]
But that's about the

bash -c 'sh -c "trap : INT; sleep 10"; echo seen; sleep 10'

where bash and AT&T ksh (contrary to all other shells I tried)
let you see "seen" above if you press Ctrl-C during the first
sleep.

But in the OP's case, we've got a "trap" in the outer shell.

bash -c 'trap "echo ouch" INT;
  sh -c "trap : INT; sleep 10"; echo seen; sleep 10'

Where you see "ouch" and "seen" in all shells (regardless of
whether the inner sh traps the SIGINT or not). So it looks like
a different issue.


Reply via email to