shell script puzzler
Chris Torek
chris at mimsy.UUCP
Wed Mar 22 20:47:18 AEST 1989
In article <995 at etnibsd.UUCP> vsh at etnibsd.UUCP (Steve Harris) writes:
>Here is one for the shell programming gurus: given the following
>shell script, how can I get the subshell to echo its true pid??
>(I am running SunOS 3.4, if it matters).
>#! /bin/sh
>echo $$ # echos pid of parent shell
>( echo $$ ) # echos same pid
At least in 4BSD, you cannot. `sh' sets up `$$' near the top of main()
and never changes it (except when running a script, in lieu of starting
a new /bin/sh to run it).
--
In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 7163)
Domain: chris at mimsy.umd.edu Path: uunet!mimsy!chris
More information about the Comp.unix.wizards
mailing list