[plug] shell scripting and process ids

Russell Steicke russells at plug.linux.org.au
Wed Aug 28 20:54:09 WST 2002


A question about shell scripting (sh and bash specifically), pipelines
and process ids.

If I run the pipeline

  prog | logger &

Then the shell magic variable $! gives me the pid of the logger
process.  Can anyone tell me how to get the pid of prog?

Alternatively, I can do this:

  exec > file

to send all the shell output to a file.  Is there some way to do this
(which doesn't work, but shows what I want to do):

  exec | logger


TIA
Russell



More information about the plug mailing list