-Original Message-
From: Bob Proulx [mailto:[EMAIL PROTECTED]
Sent: Friday, February 22, 2008 6:53 AM
To: Robert Whent (rwhent)
Cc: bug-bash@gnu.org
Subject: Re: problems substituting 'jobs' in a bash script
Robert Whent (rwhent) wrote:
> sleep 100 &
> sleep 200 &a
Robert Whent (rwhent) wrote:
> sleep 100 &
> sleep 200 &
> sleep 300 &
> JOBS=`jobs`
> I have also trawled the web and can find no reports of any issues ?
More typically this data would be collected up as you go along.
sleep 100 &
JOBS="$JOBS $!"
sleep 200 &
JOBS="$JOBS $!"
sleep 300 &
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
According to Robert Whent (rwhent) on 2/21/2008 10:59 AM:
|
| JOBS=`jobs`
|
| echo $JOBS
|
| this return nothing at all
As well it should. jobs returns information about the current shell's
jobs. But inside ``, the command is executed in a subshell
I am having real problems in retrieving the response from 'jobs' after
backgrounding a number of jobs
sleep 100 &
sleep 200 &
sleep 300 &
JOBS=`jobs`
echo $JOBS
this return nothing at all
If I access bash from the command line though, I can manually execute
the same commands and see the