我们知道根目录是/,根据posix,还有另一个目录//与/不同。当你 ls / 和 ls // 时,输出是一样的,就像 stat,但是如果你 cd / 和 cd //,它们是不同的,尽管目录内容是一样的。这真的让我很困惑。有人有答案吗?
问问题
1916 次
1 回答
25
来自Bash 常见问题解答:
E10) Why does `cd //' leave $PWD as `//'?
POSIX.2, in its description of `cd', says that *three* or more leading
slashes may be replaced with a single slash when canonicalizing the
current working directory.
This is, I presume, for historical compatibility. Certain versions of
Unix, and early network file systems, used paths of the form
//hostname/path to access `path' on server `hostname'.
于 2013-05-30T16:32:43.837 回答