Tested on a debian and debian-based:
$ cd // && pwd && ls
//
bin build dev home ...
Why is the path // a valid path?
Tested on a debian and debian-based:
$ cd // && pwd && ls
//
bin build dev home ...
Why is the path // a valid path?
According to the POSIX specification:
A pathname that begins with two successive slashes may be interpreted in an
implementation-defined manner, although more than two leading slashes shall be
treated as a single slash.
I'm guessing bash resolves the two slashes to a single slash, so they both mean the same thing. And according to the specification, cd /// should also give the same output.
You can check the inode number of the current directory using
stat -c "%i" .
and you'll notice that the inode number of / and // are the same.
This question has already been answered here.
On most POSIX systems, multiple slashes are simply ignored.
/a/b/cis a relative URI, while an URI//a/b/cis an absolute one, andais the host name. – Joker_vD Apr 16 '14 at 16:48