shell script and child pid's
Robert Brown
rlb at lavalite.asd.sgi.com
Sun Jan 27 03:15:28 AEST 1991
In article <9101252007.AA06669 at karron.med.nyu.edu>, Dan
Karron at UCBVAX.BERKELEY.EDU writes:
|>
|> How can I catch the pid of a spawned process from sh ?
|>
|> I know that you can run ps and recover the child pid from the parent pid,
|> but if the shell is telling you the pid, why not pick it up and use it ?
|> ps won't be able to tell you which child pid is the one you want if you
|> spawn a number is like-named children.
|>
|> There must be a simple trick out there !
|> Cheers!
|>
|> dan.
The built-in shell variable $! contains it:
$ sleep 60 &
1990
$ echo $!
1990
$
Bob Brown
------------------------------------------------------------------
Silicon Graphics, Inc. Advanced Systems Division 415 335 7299
More information about the Comp.sys.sgi
mailing list