Hi,

According to the bash manpage and to "help pwd", "pwd -P" should only print
something but not change the state of bash.

However, if bash is launched as "sh", the "pwd -P" command alters $PWD to
the resolved canonical full path name, and if the prompt contains \w, it is
also updated to the canonical value. Example:

~ $ PS1='\w \$ ' sh
~ $ ln -s /usr/bin /tmp/xxx
~ $ cd /tmp/xxx
/tmp/xxx $ pwd
/tmp/xxx
/tmp/xxx $ echo $PWD
/tmp/xxx
/tmp/xxx $ pwd -P
/usr/bin
/usr/bin $ pwd
/tmp/xxx
/usr/bin $ echo $PWD
/usr/bin
/usr/bin $ 

Either it's a bug, or the docs forget to mention that "pwd -P" alters $PWD
if in "sh" mode.

Tested with bash 3.1.17 and 3.2.0.


-- 
Egmont


_______________________________________________
Bug-bash mailing list
Bug-bash@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-bash

Reply via email to