Originally Posted by
jeffcobb
This is a dumb question that I thought of when working whilst tired and more than once when meaning to 'cd ..' (go up one directory) did a 'cd //'. Where exactly does that leave you? pwd just gives the obvious and frankly useless:
Code:
jeff@jeffdeb://$ pwd
//
Now doing an ls shows me to be in the root (not /root but /) but there has GOT to be some differences between /root and //. Anyone with a clue?
You're seeing the shell's (not quite so intelligent) caching of the current directory. If you actually called getcwd(), the system call, it would return "/".
UNIX path parsing treats multiple slashes as a single slash. You should be in the root dir.
EDIT: Hmm. Maybe there's more to it. When I "cd //" I see the same thing you are seeing. But "cd ///" takes me to plain old "/". Not sure now!
Here's what Python says:
Code:
scott@VM-Kubuntu-1:~$ cd //
scott@VM-Kubuntu-1://$ python
Python 2.6.5 (r265:79063, Apr 16 2010, 13:57:41)
[GCC 4.4.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import os
>>> print os.getcwd()
/
Python uses the real getcwd() call, so I think it really is just "/" and you're seeing some shell funniness.