On Thu, May 25, 2017 at 09:03:43AM +0200, Otto Moerbeek wrote:
> On Wed, May 24, 2017 at 04:27:06PM -0400, Choose a display name wrote:
> 
> > I don't quite understand the description of the PPID in the sh manual.
> > 
> > >PPID The shell's parent process ID. Subshells have the same
> > > PPID as the parent of the current shell.
> > 
> > PPID is the shell's parent's pid, okay (by the way, shouldn't the
> > second "'s" be added?). But, according to the next sentence, subshells
> > have the same value in their PPIDs as the current shell's parent have
> > in its PPID. Is it correct?
> 
> Yes, 
> http://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18

I think the point is that the current phrasing in sh(1) is incorrect.
POSIX says this:

        In a subshell [...], PPID shall be set to the same value as that
        of the parent of the current shell.

and sh(1) says this:

        Subshells have the same PPID as the parent of the current shell.

I think either we should say something more explicit like

        The PPID in a subshell is the PID of the parent of the current
        shell.

or we drop "the parent of":

Index: sh.1
===================================================================
RCS file: /var/cvs/src/bin/ksh/sh.1,v
retrieving revision 1.141
diff -u -p -r1.141 sh.1
--- sh.1        16 Mar 2017 20:06:37 -0000      1.141
+++ sh.1        25 May 2017 07:31:53 -0000
@@ -2091,7 +2091,7 @@ Enable POSIX mode
 The shell's parent process ID.
 Subshells have the same
 .Ev PPID
-as the parent of the current shell.
+as the current shell.
 .It Ev PS1
 User prompt displayed every time an interactive shell
 is ready to read a command.

Reply via email to