[Pdx-pm] solved: job control (still got a question)

forehead nforrett at wgz.com
Mon Jun 2 18:22:30 CDT 2003


On Mon, 2 Jun 2003, Randall Hansen wrote:

> First, thanks for everyone's help.  I have one nagging question
> (immediately below) and then a brief explanation of what I was
> solving.
> 
> At this point the only thing that confuses me is the output
> from:
> 	$ perl -e "print `jobs`"

The reason why your example is not working is because it is the shell 
processing the backticks.


$ perl -e "print `jobs`"

is processed as follows:

- The shell sees the double quotes and performs its own interpolation.
- The shell sees the backticks, so it runs the jobs builtin.
- The shell takes the output of jobs and substitutes it for the backticks.
- After the shell is finished, it is as if you typed the following at your
  prompt:

perl -e "[1]+  Stopped                 pine  (wd: /usr/src)"

The contents in the quotes are not legal perl, and that is why it is 
complaining. If this is good enough for you, try the following:

perl -e "print \"`jobs`\""

After shell backtick processing you end up with:

perl -e "print \"[1]+  Stopped                 pine  (wd: /usr/src)\""

Which results in the following perl getting executed:

print "[1]+  Stopped                 pine  (wd: /usr/src)"


-- Nick





More information about the Pdx-pm-list mailing list