help-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: value of $$ in backgrounded process


From: Greg Wooledge
Subject: Re: value of $$ in backgrounded process
Date: Wed, 6 Oct 2021 14:39:25 -0400

On Wed, Oct 06, 2021 at 04:20:36PM +0200, kovacs istvan wrote:
> I have been through the docs, but could not find clearly:
> 
> what should $$ expand to in a backgrounded process?
> 
> Currently it will expand to the main process ID. Is this fixed, or 
> implementation specific?

That's the intended behavior.  It's not a bug.  $$ always expands to the
process ID of the main shell, even when used within a subshell.

If you want the process ID of a subshell, there's BASHPID.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]