bug-bash
[Top][All Lists]
Advanced

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

Re: 'wait' in command group in pipeline fails to recognize child process


From: Martin Jambon
Subject: Re: 'wait' in command group in pipeline fails to recognize child process
Date: Tue, 22 Jun 2021 17:52:53 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.8.1

On 6/22/21 5:00 PM, Lawrence Velázquez wrote:
Maybe something like this would get the point across:

        ($$) Expands to the process ID of the shell.  In a subshell,
             it expands to the value that $$ has in the invoking shell.

It's better. However, the reader is still left wondering what "the shell" is referring to in first sentence.

Here's my next suggestion, which borrows some language from the documentation for BASHPID:

($$) Expands to the ID of the process that initialized Bash. The value of $$ is inherited in subshells, such as pipelines, regardless of their own process ID. See also the Bash variable BASHPID.

For reference, the documentation for 'BASHPID' is this:

Expands to the process ID of the current Bash process. This differs from $$ under certain circumstances, such as subshells that do not require Bash to be re-initialized. Assignments to BASHPID have no effect. If BASHPID is unset, it loses its special properties, even if it is subsequently reset.



reply via email to

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