The ksh(1) manual says that PPID should be read-only. But: $ man ksh | grep PPID PPID The process ID of the shell's parent (read-only). $ echo ${PPID} 5967 $ PPID=123 $ echo ${PPID} 123
We can fix either the manual or ksh itself; this diff takes the latter approach. It is tempting to do this with "typeset -ir PPID" but that actually doesn't work: $ FOO=123 $ typeset -ir FOO ksh: FOO: is read only So we fix this by putting "typeset -r PPID" on its own line. One could imagine shortening the section below with something like: "typeset", "-i", "PPID", "OPTIND=1", NULL, "typeset", "-r", "KSH_VERSION", "PPID", NULL, "typeset", "-x", "SHELL", "PATH", "HOME", NULL, but that involves some reordering: the -i's MUST come before the -r's. Index: bin/ksh/main.c =================================================================== RCS file: /open/anoncvs/cvs/src/bin/ksh/main.c,v retrieving revision 1.79 diff -u -p -r1.79 main.c --- main.c 4 Mar 2016 15:11:06 -0000 1.79 +++ main.c 8 Sep 2016 13:17:29 -0000 @@ -85,6 +85,7 @@ static const char *initcoms [] = { "typeset", "-r", "KSH_VERSION", NULL, "typeset", "-x", "SHELL", "PATH", "HOME", NULL, "typeset", "-i", "PPID", NULL, + "typeset", "-r", "PPID", NULL, "typeset", "-i", "OPTIND=1", NULL, "eval", "typeset -i RANDOM MAILCHECK=\"${MAILCHECK-600}\" SECONDS=\"${SECONDS-0}\" TMOUT=\"${TMOUT-0}\"", NULL, "alias",