Difference b/w / and // - Unix

This is a discussion on Difference b/w / and // - Unix ; Hi, Can anybody explain this behaviour? > cd / > pwd / > cd // > pwd // > cd /// > pwd / I am using solaris 8. And I don't have a folder name '/' inside root i.e. ...

+ Reply to Thread
Results 1 to 3 of 3

Thread: Difference b/w / and //

  1. Difference b/w / and //

    Hi,
    Can anybody explain this behaviour?

    > cd /
    > pwd

    /

    > cd //
    > pwd

    //


    > cd ///
    > pwd

    /

    I am using solaris 8. And I don't have a folder name '/' inside root
    i.e. /



    --
    Ben


  2. Re: Difference b/w / and //

    On Apr 19, 9:23 am, ben wrote:
    > Hi,
    > Can anybody explain this behaviour?
    >
    > > cd /
    > > pwd

    >
    > /
    >
    > > cd //
    > > pwd

    >
    > //
    >
    > > cd ///
    > > pwd

    >
    > /
    >
    > I am using solaris 8. And I don't have a folder name '/' inside root
    > i.e. /
    >
    > --
    > Ben



    hii ben

    solaris or unix is based on a hierarchial structure with every
    subdirectory a part of the root / directory by default

    pwd is your preaent working directory
    by default when u login ,u work in the root directory and can navigate
    to other directories
    when u say pwd for the 1st time...its shows /
    2nd time its / within / so //
    3 rd time wen u say cd/// cd// takes it to root directory again
    hence / output


  3. Re: Difference b/w / and //

    On 2007-04-19, ben wrote:
    > Hi,
    > Can anybody explain this behaviour?
    >
    >> cd /
    >> pwd

    > /
    >
    >> cd //
    >> pwd

    > //
    >
    >
    >> cd ///
    >> pwd

    > /


    I'm not sure about traditional Unix behaviour, but this is as
    described in POSIX. POSIX states that ///, //// etc are to be
    treated as a single /. // is reserved for system specific behaviour,
    but on most (all?) true Unix systems it behaves like all the rest.

    I recall a discussion on one of the cygwin mailing lists 10-12
    years ago that dealt with this. One of the proposals was to use
    something like //a//file.txt as a way of specifying drive letters
    whilst still having fully POSIX compliant pathnames. I'm not sure
    how they eventually decided to deal with this: I don't think that
    proposal was used.

    In any case, there effectively isn't any difference on Unix. If
    typing /bin/ls at a shell prompt works, so will /bin//ls or even
    /bin/////////////////ls.

    --
    Andrew Smallshaw
    andrews@sdf.lonestar.org

+ Reply to Thread