bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: $(pwd) != $(/bin/pwd)


From: Stephane CHAZELAS
Subject: Re: $(pwd) != $(/bin/pwd)
Date: Mon, 4 Jan 2010 13:25:50 +0000 (UTC)
User-agent: slrn/pre1.0.0-16 (Linux)

2010-01-03, 17:23(-05), Chet Ramey:
[...]
>> darkk@thinkpad ~ $ cd foo
[...]
>> darkk@thinkpad ~/foo $ mv ~/foo ~/bar
[...]
>> darkk@thinkpad ~/foo $ echo $PWD
>> /home/darkk/foo
>> darkk@thinkpad ~/foo $ pwd
>> /home/darkk/foo
>> darkk@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


reply via email to

[Prev in Thread] Current Thread [Next in Thread]