On Sat, Jun 28, 2008 at 04:25:28PM +0200, Miroslav Rudisin wrote: > > On Mon, May 26, 2008 at 02:58:17PM +0200, Miroslav Rudisin wrote: > > > children's PIDs are not printed when called in eval block > > > > > > $ sleep 1000 & > > > $ sleep 100 & > > > $ jobs -p > > > 14202 > > > 14201 > > > $ echo $(jobs -p) > > > > > > $ > > > > Hi, I don't think that's a bug, the jobs builtin 'shall display the > > status of jobs that were started in the current shell environment;'[0] > > > > When running jobs in a subshell, you change the shell environment for > > the jobs builtin. > > ok, i understand. but then we have not reasonable way to store pids of > background > process into shell variable... > > $ sleep 1000 & > $ sleep 100 & > > $ for i in `jobs -p`; do echo $i; done # doesn't work > $ jobs -p | xargs # doesn't work > > only working way is redirecting output to the file > > $ jobs -p > /tmp/pids # this works
You should use $!. Cheers, -- Email: Herbert Xu <herb...@gondor.apana.org.au> Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt -- To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org