[Gllug] Filesystem root directory oddity

Richard Huxton dev at archonet.com
Tue Mar 17 20:35:11 UTC 2009


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

$ cd /home/richardh/; pwd; cd //; pwd
/home/richardh
//

It's something to do with a leading doubled slash:
$ cd //var//log//; pwd
//var/log

> 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.

-- 
  Richard Huxton
  Archonet Ltd
-- 
Gllug mailing list  -  Gllug at gllug.org.uk
http://lists.gllug.org.uk/mailman/listinfo/gllug




More information about the GLLUG mailing list