[ale] Quick LInux Quiz
Bjorn Dittmer-Roche
bjorn at sccs.swarthmore.edu
Mon Mar 15 17:31:45 EST 2004
On Mon, 15 Mar 2004, Jason Vinson wrote:
> isn't that the same thing as cd /?
>
> at least that's what I see.
>
> Jason
>
>
> On Mar 15, 2004, at 5:13 PM, Michael D. Hirsch wrote:
>
> > Quick! What is the effect of "cd //"? I sure guessed wrong.
> >
> > I don't really understand what is happening when I do that on RH under
> > bash.
> > Can anyone explain this?
this:
$ cd /
and this:
$ cd //
should both take you to the root directory. This is because POSIX mandates
that multiple slashes in a row must be equivilant to a single slash. This
is handy in cases like this:
psedocode:
path1 = "/path/1"
path2 = "/path/2/"
randompath = pickAPathAtRandom( path1, path2 )
afile = "file.name"
fullpath = randompath + "/" + afile
I think there is a limit to the number of consecutive /'s that POSIX
requires resolving to a single /.
bjorn
More information about the Ale
mailing list