This actually came up when my department was trying to solve a problem the
other day; I figured it might be slightly interesting. :)
In most Unix shells, $$ is supposed to return the pid of the current
process. () produces subshells. So why does the following little script
return the same two values --
#!/bin/sh
echo $$
(echo $$)
-- and, since the "obvious" thing doesn't work, what are the possible
workarounds if you want to get the pid of a subshell?
The answer made me laugh, but then again, I have a weird sense of humor. ;)
Shawn
This archive was generated by hypermail 2b29 : Wed Apr 27 2005 - 03:30:03 EDT