[Gllug] Filesystem root directory oddity

John Winters john at sinodun.org.uk
Tue Mar 17 20:57:17 UTC 2009


Richard Huxton wrote:
> John Winters wrote:
>> Richard Huxton wrote:
>>> $ cd /; pwd; cd //; pwd; cd ///; pwd cd ////; pwd
>>> /
>>> //
>>> /
>>> /
>> If you invoke /bin/pwd instead of the in-built pwd you get a correct
>> location of "/" for every case.  AFAICR the shell's in-built pwd uses a
>> sort of "remember where you last moved to" strategy to produce its
>> results. 
> 
> Ah, /bin/pwd does seem to work. Not sure about the "remembering" part

An illustration:

john at liberty:~$ mkdir able
john at liberty:~$ ln -s able baker
john at liberty:~$ cd baker
john at liberty:~/baker$ pwd
/home/john/baker
john at liberty:~/baker$ /bin/pwd
/home/john/able
john at liberty:~/baker$

/bin/pwd is reporting your actual current working directory whilst the
in-built pwd is reporting where it remembers you last moved to.

[snip]
>> It looks to me like you might have tickled a small bug in your
>> shell.
> 
> Does it on Ubuntu 8.10, Debian etch, lenny and even an old Fedora Core 2
> box I just powered up.

And the shell which you are using in each case is?

John
-- 
Gllug mailing list  -  Gllug at gllug.org.uk
http://lists.gllug.org.uk/mailman/listinfo/gllug




More information about the GLLUG mailing list