2010-01-03, 17:23(-05), Chet Ramey: [...] >> da...@thinkpad ~ $ cd foo [...] >> da...@thinkpad ~/foo $ mv ~/foo ~/bar [...] >> da...@thinkpad ~/foo $ echo $PWD >> /home/darkk/foo >> da...@thinkpad ~/foo $ pwd >> /home/darkk/foo >> da...@thinkpad ~/foo $ /bin/pwd >> /home/darkk/bar [...] > It's not a bug, nor a "strange feature." Bash maintains a logical view of > the file system and the current directory for cd, pwd, and $PWD, as Posix > specifies. One of the consequences is that the pathname of the current > directory depends on the path used to reach it. [...]
Well, if I read http://www.opengroup.org/onlinepubs/9699919799/utilities/pwd.html correctly, bash pwd should output /home/darkk/bar in that case as $PWD does *not* contain an absolute path to the current directory. Having said that, ksh93, ash and zsh behave like bash, pdksh and its derivatives being the only ones that behave as POSIX requires. -- Stéphane