Announcement

Collapse
No announcement yet.

The // directory

Collapse
This topic is closed.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    The // directory

    OK, this was unexpected:

    Code:
    steve@t520:~$ [B]cd /[/B]
    steve@t520:/
    
    steve@t520:/$ [B]cd //[/B]
    steve@t520://    [I][COLOR="#B22222"]<--- What is this I don't even[/COLOR][/I]
    
    steve@t520://$ [B]pwd[/B]
    //
    
    steve@t520://$ [B]ls -al[/B]
    total 16
    drwxr-xr-x   1 root root  226 Feb 25 13:18 .
    drwxr-xr-x   1 root root  226 Feb 25 13:18 ..
    drwxr-xr-x   1 root root 2314 Mar  5 09:19 bin
    drwxr-xr-x   1 root root  626 Feb 25 13:22 boot
    drwxr-xr-x  17 root root 4220 Mar  3 13:47 dev
    drwxr-xr-x   1 root root 4636 Mar  8 21:35 etc
    drwxr-xr-x   1 root root   30 Dec 21 00:42 home
    drwxr-xr-x   1 root root  832 Feb 27 09:57 lib
    drwxr-xr-x   1 root root 1304 Feb 27 09:57 lib32
    drwxr-xr-x   1 root root  112 Feb 27 09:57 lib64
    drwxr-xr-x   1 root root   54 May 13  2014 media
    drwxr-xr-x   1 root root   16 Dec 22 15:05 mnt
    drwxr-xr-x   1 root root   50 Feb 27 11:03 opt
    dr-xr-xr-x 255 root root    0 Mar  3 13:47 proc
    drwx------   1 root root  380 Dec 21 00:42 root
    drwxr-xr-x  33 root root 1160 Mar  4 09:14 run
    drwxr-xr-x   1 root root 3906 Feb 27 09:57 sbin
    drwxr-xr-x   1 root root    0 Apr 16  2014 srv
    dr-xr-xr-x  13 root root    0 Mar  4 22:22 sys
    drwxrwxrwt  14 root root  380 Mar  8 21:46 tmp
    drwxr-xr-x   1 root root   80 Dec  2 13:24 usr
    drwxr-xr-x   1 root root  114 May 10  2014 var
    OK, so // = /. But why does it exist?

    #2
    http://stackoverflow.com/questions/2...-mean-in-linux

    (doesn't happen with zsh, btw)

    Comment


      #3
      Thanks. "Implementation-defined manner." That's...comforting!

      Comment


        #4
        Originally posted by SteveRiley View Post
        // = /. But why does it exist?
        It doesn't really, bash just calls it that because you called it that. If I
        Code:
        cd $HOME
        ln -s / foo
        cd foo
        pwd
        /home/john/foo
        /bin/pwd
        /
        Regards, John Little

        Comment


          #5
          OK, that just kinda blew my mind.

          Comment


            #6
            Curiously, cd ///, or cd /////////////////////////////////// does not do it. // seems a special case.
            Regards, John Little

            Comment


              #7
              Originally posted by jlittle View Post
              Curiously, cd ///, or cd /////////////////////////////////// does not do it.
              POSIX rules (http://pubs.opengroup.org/onlinepubs...ml#tag_04_11):
              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.

              Comment

              Working...
              X