[Top][All Lists]

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

Re: while sleep 1;do :& done vs. C-z

From: Chet Ramey
Subject: Re: while sleep 1;do :& done vs. C-z
Date: Fri, 22 Oct 2004 14:43:46 -0400
User-agent: Mozilla/5.0 (Windows; U; Win 9x 4.90; en-US; rv:1.7.3) Gecko/20040910

Dan Jacobson wrote:

$ while sleep 1;do :& done
Then after a while type C-z bg RET
Notice how our loop poops out quickly. Contrast that with
$ while sleep 1; do :& done&
which we can fg C-z bg all we like.

Consider what you're doing, and where in the process tree
you're doing it.  Job control works only on individual processes.

I suspect that chances are pretty good you're stopping the
`sleep 1' process in the first example, which causes it to return
to the calling shell with a non-zero exit status (probably
128+SIGTSTP).  That breaks the loop.

In your second example, you're manipulating the subshell started
to run the loop in the background.  Since that's a single process, it's
possible to stop and start it.


reply via email to

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