Reputation: 737
I just found the direcory //
on my machine and now i am wondering what it means.
user@dev:~$ cd /
user@dev:/$ pwd
/
user@dev:/$ cd //
user@dev://$ pwd
//
It is obvously the root directory, but when and why do i use the double slash instead of the single slash?
Is it related to the escaped path strings which i use while programming? For example:
string path = "//home//user//foo.file"
I also tried it with zsh but it changes to the usual root directory /
. So I think its bash specific.
Upvotes: 1
Views: 120
Reputation: 81002
This is part of the specification for Pathname Resolution:
A pathname consisting of a single <slash> shall resolve to the root directory of the process. A null pathname shall not be successfully resolved. If a pathname begins with two successive <slash> characters, the first component following the leading <slash> characters may be interpreted in an implementation-defined manner, although more than two leading <slash> characters shall be treated as a single <slash> character.
So your shell is just following the specification and leaving //
alone as it might be implementationally defined as something other than /
.
Upvotes: 5