[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: |
Tue, 5 Jan 2010 19:54:32 +0000 |
User-agent: |
Mutt/1.5.16 (2007-09-19) |
2010-01-05 20:23:39 +0100, Andreas Schwab:
> Greg Wooledge <wooledg@eeg.ccf.org> writes:
>
> > On Mon, Jan 04, 2010 at 01:25:50PM +0000, Stephane CHAZELAS wrote:
> >> >> darkk@thinkpad ~/foo $ echo $PWD
> >> >> /home/darkk/foo
> >
> >> 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.
> >
> > An "absolute pathname" is one that begins with a / character. As
> > opposed to a "relative pathname" which does not, and which is resolved
> > relative to your current working directory.
> >
> > $PWD is always an absolute pathname.
>
> There are two conditions: 1. absolute pathname and 2. to the current
> directory. The second one is violated.
[...]
That's indeed what I meant. In that case $PWD does contain an
absolute pathname, but to something that used to be the current
directory and is now non-existent or worse could have been
recreated as a different directory from the current one.
In that case, POSIX says that pwd should return the same as pwd
-P (so for instance if /home was a symlink to /export/home,
something like /export/home/darkk/bar).
--
Stephane
- $(pwd) != $(/bin/pwd), Leonid Evdokimov, 2010/01/03
- Re: $(pwd) != $(/bin/pwd), Chet Ramey, 2010/01/03
- Message not available
- Re: $(pwd) != $(/bin/pwd), Chet Ramey, 2010/01/05
- Re: $(pwd) != $(/bin/pwd), Stephane CHAZELAS, 2010/01/06
- Re: $(pwd) != $(/bin/pwd), Chet Ramey, 2010/01/06
- Re: $(pwd) != $(/bin/pwd), Marc Herbert, 2010/01/07