bug-bash
[Top][All Lists]
Advanced

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

sh, pwd -P and $PWD


From: Egmont Koblinger
Subject: sh, pwd -P and $PWD
Date: Mon, 13 Nov 2006 15:26:56 +0100
User-agent: Mutt/1.5.8i

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




reply via email to

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