Bug#482999: dash: builtin function 'jobs -p' doesn't work as expected

2014-10-27 Thread Herbert Xu
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 
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



Bug#482999: dash: builtin function 'jobs -p' doesn't work as expected

2008-06-28 Thread Miroslav Rudisin
> 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




-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]



Bug#482999: dash: builtin function 'jobs -p' doesn't work as expected

2008-06-12 Thread Gerrit Pape
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.

Regards, Gerrit.

[0] http://www.opengroup.org/onlinepubs/009695399/utilities/jobs.html



-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]