Re: change dir to //

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 01/16/2011 03:54 PM, MichaÅ Piotrowski wrote:
> Hi,
> 
> I wonder why such a thing is possible
> [michal@ozzy ~]$ cd /
> [michal@ozzy /]$ pwd
> /
> [michal@ozzy /]$ cd //
> [michal@ozzy //]$ pwd
> //

Because POSIX says that leading // is allowed (but not required) to have
a separate interpretation from / (no other spelling gets this special
treatment; leading /// must be identical to leading /).  Some systems,
like Cygwin, use this POSIX requirement to implement an alternate access
space, where //server/share is used, in perfect compliance with POSIX,
to represent windows remote share drives.  Since bash is ported to
cygwin, the bash maintainer chose to preserve // as special for all
systems, whether or not it actually is special.  On Linux, it happens to
not be special.  Other shells, like zsh, only treat // as special on
platforms where it really is special, and collapse it to / otherwise.

However, you have not pointed out any bugs - since POSIX is explicit
that // is special, you are better off avoiding // and not worrying
about whether a program collapses // into /.

-- 
Eric Blake   eblake@xxxxxxxxxx    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature

-- 
test mailing list
test@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe: 
https://admin.fedoraproject.org/mailman/listinfo/test

[Index of Archives]     [Fedora Desktop]     [Fedora SELinux]     [Photo Sharing]     [Yosemite Forum]     [KDE Users]

  Powered by Linux