CWD vs PWD
Linuxmisc » Unix shell
I know that PWD is an environment variable while CWD is normal shell
variable. Is is there any other difference between these ? eg. With
respect to mount options, file system etc.
regards
I presume you mean the "cwd" (lower case) shell variable? In
which case you must be using a csh-like shell? According the
the tcsh man page on my sytem:
PWD (+) Equivalent to the cwd shell variable, but not syn-
chronized to it; updated only after an actual
directory change.
The (+) there indicates that the PWD variable is actually a tcsh
feature not found in traditional csh implementations, so I'll
further guess that you are using tcsh.
What the "not syncronized to it" phrase above refers to is that
the sequence:
cd /tmp
echo $cwd $PWD
set cwd = foo
echo $cwd $PWD
cd .
echo $cwd $PWD
will show different values for the two variables in that middle
echo command.
--Ken Pizzini