testing了一个基于debian和debian的:
$ cd // && pwd && ls // bin build dev home ...
为什么path//有效的path?
根据POSIX规范 :
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.
我猜bash解决了两个斜杠单斜杠,所以他们都意味着同样的事情。 根据规范, cd ///也应该给出相同的输出。
您可以使用检查当前目录的inode号码
stat -c "%i" .
你会注意到/和//的inode号是一样的。
这个问题已经在这里回答了 。
在大多数POSIX系统上,简单地忽略了多个斜杠。