On Wed, February 2, 2005 1:24 am, Sebastian Flothow said:
> Am 2. Feb 2005 um 06:35 Uhr schrieb John Myers:
>> It would keep the connection to the master open, and would also have a
>> consistent PID (unlike a shell script, which, AFAIK, may not).
>
> A shell script itself has a consistent PID. However, any command called
> within a shell script is assigned a new PID.
>
That's not entirely true. Subshells are not executed in the same process as
the script.
f.ex.:
If my script contains the line
    foo $(bar baz) quux
the 'bar baz' part is executed in a separate shell from the 'foo
<whatever> quux' part.

Don't try to make a counterexample involving the $$ variable. It won't
work as variables are substituted by the original shell. Try this instead:
     bash -c '$(echo $(echo $(echo $(echo $(echo $(read))))))'
suspending it, looking in ps, and counting how many shells you now have
running. (the bash -c part is so that you _can_ suspend it)



--
[email protected] mailing list

Reply via email to