PWD is considered local in /bin/ksh while it is global in most other shells
(ksh93, csh, bash, zsh).
In practice, it means calling getenv("PWD") from a child process returns NULL
on ksh (and pdksh) unless you export it before hand.
I discovered this while using getenv("PWD") to get the parent shell's current
path without resolved symlinks. It worked everywhere except on my OpenBSD
machines.
I don't mind putting export PWD in my kshrc but is there a reason why it
couldn't be a default?
-b
Index: main.c
===================================================================
RCS file: /cvs/src/bin/ksh/main.c,v
retrieving revision 1.52
diff -p -u -r1.52 main.c
--- main.c 15 Jun 2013 17:25:19 -0000 1.52
+++ main.c 21 Jul 2013 19:10:02 -0000
@@ -31,7 +31,7 @@ static const char initsubs[] = "${PS2=>
static const char *initcoms [] = {
"typeset", "-r", "KSH_VERSION", NULL,
- "typeset", "-x", "SHELL", "PATH", "HOME", NULL,
+ "typeset", "-x", "SHELL", "PATH", "HOME", "PWD", NULL,
"typeset", "-i", "PPID", NULL,
"typeset", "-i", "OPTIND=1", NULL,
"eval", "typeset -i RANDOM MAILCHECK=\"${MAILCHECK-600}\"
SECONDS=\"${SECONDS-0}\" TMOUT=\"${TMOUT-0}\"", NULL,