Brandin Creech wrote: > Has anyone noticed this: in Bash, the command > > cd //usr//bin > > causes PWD to become "//usr/bin" instead of "/usr/bin".
Yes, that's how it's supposed to be. Or maybe it isn't. Or ... more on that later. > Bash's normal > behavior is to replace all repeated /'s with a single slash. Yes, that's also how it's supposed to be. > Right now I'm > using Bash 3.00.16, but I've also tried older versions and noticed the same > behavior. This happens for any "cd" command that contains an initial double > slash, but it works fine for ///. For instance > > cd ///usr//bin > > sets the PWD as "/usr/bin". > > This problem It isn't a problem. > only appears to be cosmetic; I haven't had any program complain > when $PWD contains //. But does anyone know how to fix this. You can't. > Or maybe it's > not even a Bash thing, but is somehow related to the kernel or glibc? No, it's not. The filesystem namespace beginning with '//' is reserved by POSIX as an implementation defined namespace that is totally seperate from the POSIX filesystem namespace beginning with '/'. "Implementation defined" of course means, that any implementation can behave anyway it likes in this namespace or -- to say it simple -- inside this namespace you never know what's gonna happen. So, the behaviour of Bash is neither right nor wrong, it's just what the Bash implementors thought made sense. And I think they're right. Stripping one slash would be wrong, because you cannot silently jump from one namespace to another. However, doing something weird wouldn't be exactly helpful either. So, pretending you were in the POSIX namespace but not actually leaving the implementation defined namespace is exactly the right thing to do. (POSIX isn't freely available AFAIK, but SUSv3, which is identical to POSIX is, see: <http://www.opengroup.org/onlinepubs/009695399/basedefs/xbd_chap03.html#tag_03_02> and <http://www.opengroup.org/onlinepubs/009695399/basedefs/xbd_chap04.html#tag_04_11>.) BTW: Try to run /bin/pwd instead of Bashs builtin pwd and see whether it makes any difference. Mine does. jwm -- http://linuxfromscratch.org/mailman/listinfo/blfs-support FAQ: http://www.linuxfromscratch.org/blfs/faq.html Unsubscribe: See the above information page