problems substituting 'jobs' in a bash script

2008-02-21 Thread Robert Whent (rwhent)
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

Re: problems substituting 'jobs' in a bash script

2008-02-21 Thread Eric Blake
-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

Re: problems substituting 'jobs' in a bash script

2008-02-21 Thread Bob Proulx
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 &