On Thu, 14 Jul 2005, Dave Anderson wrote: > >I did not check your script, but POSIX says this: > > > >$ Expands to the decimal process ID of the invoked shell. In a > > subshell (see Shell Execution Environment ), '$' shall expand to the > > same value as that of the current shell. > > > >There's a similar phrase in the man page, > > Sorry if I was unclear -- it's certainly documented (though exactly > what "original" as used in the man page means wasn't totally obvious to > me without doing some testing); my curiosity is about the reasoning > behind making the PID/PPID of the "original" shell easily available > while leaving those of the subshell inaccessible.
The developer of the shell has the freedom to either spawn a separate process for a subshell expression or execute the subshell commands in the in a newly created enviroment that is a copy of the current environment environment. It is wrong to assume using (...) will actually create a new process. -Otto