On Wed, Jun 30, 2010 at 1:17 PM, Jan Schampera <[email protected]> wrote:
> Chris F.A. Johnson wrote:
>
> $$ refers to the subshell.
>>>>
>>>
>>> There's no subshell here, I think.
>>>
>>
>> The background process invoked by &.
>>
>
> $$ is meant to always report the "main shell", I'd guess this is true for
> this case, too.
>
> Running a cmd in background (by &) would not create subshell. Simple
testing:
#!/bin/bash
function foo()
{
echo $$
}
echo $$
foo &
### END OF SCRIPT ###
The 2 $$s output the same.
> J.
>
>