[Top][All Lists]

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

Re: sh, pwd -P and $PWD

From: Chet Ramey
Subject: Re: sh, pwd -P and $PWD
Date: Mon, 13 Nov 2006 10:24:36 -0500
User-agent: Thunderbird (Macintosh/20061025)

Egmont Koblinger wrote:

> 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:
> Either it's a bug, or the docs forget to mention that "pwd -P" alters $PWD
> if in "sh" mode.

POSIX requires it (from

    If the -P option is in effect, this variable shall be set to an
absolute pathname of the current working directory that does not contain
any components that specify symbolic links, does not contain any components
that are dot, and does not contain any components that are dot-dot. If an
application sets or unsets the value of PWD , the behavior of pwd is

The section on posix mode in the bash texinfo manual documents it:

"When the @code{pwd} builtin is supplied the @option{-P} option, it resets
@code{$PWD} to a pathname containing no symlinks."

There's no posix mode section in the manual page.  (Though maybe there
should be -- at the current length, what's a couple of more pages?)


``The lyf so short, the craft so long to lerne.'' - Chaucer
                       Live Strong.  No day but today.
Chet Ramey, ITS, CWRU    address@hidden    http://cnswww.cns.cwru.edu/~chet/

reply via email to

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