0

Due to a typo, I accidentally cd into //. Which turns out to be a real directory (but same content as /)

So what is the difference between / and // (despite having identical content)


Real example: (ls output shortened for brevity)

:/$ cd /
:/$ ls
bin  boot  dev  etc ...
:/$ cd //
://$ ls
bin  boot  dev  etc ...
://$ cd //////// 
:/$ ls (notice how it entered `/` and not `//`)
bin  boot  dev  etc ...
:/$

So from the test above it seems that // is a special directory. This appears to be only bash, zsh did not have this quirk. Also //etc, //var, etc; all appear to be valid

Mattisdada
  • 101
  • 1

1 Answers1

0

You are cd'ing into the same dir. Multiple slashes are ignored.

cd /

will take you to the same (in this case root) dir as

cd //

or

cd //////
MERM
  • 188
  • 1
  • 2
  • 9
  • 1
    ["A pathname that begins with two successive slashes may be interpreted in an implementation-defined manner"](http://pubs.opengroup.org/onlinepubs/009695399/basedefs/xbd_chap04.html#tag_04_11) – Michael Homer Jan 09 '17 at 03:16
  • yes, but you would have to set that up beforehand. The OP asked about "cd" – MERM Jan 09 '17 at 03:18