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: Greg Wooledge
Subject: Re: 'wait' in command group in pipeline fails to recognize child process
Date: Wed, 23 Jun 2021 19:29:45 -0400

On Wed, Jun 23, 2021 at 03:17:48PM -0700, Martin Jambon wrote:
> > What is the magic quality that imparts shellness?
> 
> '$$' matching the process ID.

That just signifies that you're in the original shell, or the main shell,
or the root shell, or the fundamental shell, or make up whatever term
you like for it.

Every bash (or sh) process is a shell, regardless of whether it's a
subshell or not.  That includes subshells, and non-sub-shells.

Here's a brief demonstration: I have two terminals opened.  The first
one is pts/3:

unicorn:~$ ps
    PID TTY          TIME CMD
    966 pts/3    00:00:00 bash
1363991 pts/3    00:00:00 ps
unicorn:~$ (sleep 10; true)

In the second terminal, while the sleep is running:

unicorn:~$ ps f -t pts/3
    PID TTY      STAT   TIME COMMAND
    966 pts/3    Ss     0:00 bash
1364016 pts/3    S+     0:00  \_ bash
1364017 pts/3    S+     0:00      \_ sleep 10

Process 966 is the interactive bash shell, which is not a subshell.  It's
the other kind of shell.

Process 1364016 is the subshell created by the (parentheses) to run the
command which was specified inside them.

They're both instances of bash.  They're both shells.

> 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.

Nobody knows what the hell to CALL it.  That's the problem.  It doesn't
have a clearly defined name, because nobody ever NEEDED one.



reply via email to

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