Tugger the SLUGger!SLUG Mailing List Archives

Re: [SLUG] // ??


Hi Marty,

>  I accidently typed cd // on one of my slackware 7.0 boxes.

>  Surprisingly it happily took me to //, which seems to be an alias for the /
>  directory.

Not quite. The pathname treats multiple /'s as a single /. I think
this is implemented in the guts of the kernel, in the routine that
translates directory paths to inode numbers and disk locations
(namei?) so it should happen for all pathnames in all applications but
I'm guessing.

If you do pwd you should see '/' and not '//'. If you do see '//' I 
would consider that a bug in slackware.
You will find you can cd to ///, or //// or even ///usr/////bin

   Interestingly this 'feature' does not occur on DeadRat, or on earlier
   versions of slackware.

Works as described on Red Hat 6.2, maybe a version you were using was busted 
or the shell was doing something weird.

You really don't want to use this '/+ == /' feature at all, the only
useful thing about it is that it saves you using the backspace key if
you notice that you've doubled up on a / in your pathname halfway
through typing it. You can also use this feature implicity in your
shell scripts- if you prompt for a pathname that's the root of a
directory tree, you can add paths including subdirectories onto it
without having to worry about stripping any possible trailing slash
from the input.

Cheers,
Stuart.