bug-bash
[Top][All Lists]
Advanced

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

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


From: Ken Irving
Subject: Re: $(pwd) != $(/bin/pwd)
Date: Tue, 5 Jan 2010 12:05:39 -0900
User-agent: Mutt/1.5.20 (2009-06-14)

On Tue, Jan 05, 2010 at 08:23:39PM +0100, Andreas Schwab wrote:
> 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.

Just an observation, but the directory can be deleted as well as renamed,
with similar results.  In this case the inode exists but has no name(s)
pointing to it.

Either case (rename or delete) can be handled in scripts, e.g., using -d
$PWD, if this sort of thing is anticipated.

--
Ken.Irving@alaska.edu




reply via email to

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