help-bash
[Top][All Lists]
Advanced

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

Re: why are pipeline commands (allowed to be) executed in subshells?


From: Greg Wooledge
Subject: Re: why are pipeline commands (allowed to be) executed in subshells?
Date: Mon, 12 Dec 2022 21:14:54 -0500

On Tue, Dec 13, 2022 at 02:29:01AM +0100, Philippe Cerfon wrote:
> So when I have e.g.
> while true; do
>     sleep 60
>     check_for_condition && break
> done
> 
> as well as a trap on e.g. HUP and INT that set some condition to be true,
> and then send a HUP to the executing shell, I'd expect that it
> waits(!) for the sleep to finish until it breaks out of the loop. And
> indeed it does. The HUP signal is only received by the shell, the
> child processes don't seem to get it.
> 
> 
> However, when sending an INT, the child immediately seems to see the INT.
> 
> Why is this happening and not a violation of the above rule?

We're going to need more information.  Are you running a script, or are
you typing that while loop into an interactive shell?

Are you sending INT by "kill -2" or by pressing Ctrl-C (or Del or whatever)?

Have you read <http://www.cons.org/cracauer/sigint.html>?



reply via email to

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