On 6/23/21 6:24 AM, Chet Ramey wrote:
On 6/22/21 9:54 PM, Martin Jambon wrote:

In the posix definition, a subshell
- is not necessarily implemented as a separate process
- belongs to a unique shell
- is not a shell

Why is it not "a shell?"

Because '$$' doesn't match its process ID.

What is the magic quality that imparts shellness?

'$$' matching the process ID.

Posix: '$' shall expand to the same value as that of the current shell. (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_05_02) Bash: ($$) Expands to the process ID of the shell. (https://www.gnu.org/software/bash/manual/bash.html#Special-Parameters)

I'm not sure why I have to fight over this. It's clearly my misunderstanding. That's why I suggest clarifications in the documentation, if you're interested in creating a better experience for users like me.


Reply via email to