Jeff Weber <[EMAIL PROTECTED]> writes:

> Here's some sample code:
>
> # create a backgrounded subshell to execute long-running processes
> #( sleep 300 && sleep 400 && sleep 500 )&       # doesn't work, bummer
> $SHELL -c "sleep 300; sleep 400; sleep 500" &   # doesn't work, bummer
> pid=$!
> echo background job $pid
>
>
> When I run this, it announces the background job pid, which I then kill.  
> I've 
> tried SIGHUP, SIGINT, SIGTERM.  The backgrounded bash job terminates as 
> expected.  However, the active sleep job continues to execute, now being 
> owned by init.  Somehow, it "escaped".  I want any active sleep job to die 
> too.
>
> Is this a bug, feature, or misunderstanding?

It's not a bug.  You only kill a single process, no other processes are
affected.

> Regardless, is there a simple solution to get the behavior I want?

You need to enable job control and kill the whole job.

Andreas.

-- 
Andreas Schwab, SuSE Labs, [EMAIL PROTECTED]
SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
PGP key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."


_______________________________________________
Bug-bash mailing list
Bug-bash@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-bash

Reply via email to