[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
"cd //" isn't the same as "cd /" or "cd ///"
From: |
Noah Spurrier |
Subject: |
"cd //" isn't the same as "cd /" or "cd ///" |
Date: |
Thu, 2 Aug 2012 20:32:40 -0700 |
Configuration Information [Automatically generated, do not change]:
Machine: x86_64
OS: linux-gnu
Compiler: gcc
Compilation CFLAGS: -DPROGRAM='bash' -DCONF_HOSTTYPE='x86_64'
-DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='x86_64-pc-linux-gnu'
-DCONF_VENDOR='pc' -DLOCALEDIR='/usr/share/locale' -DPACKAGE='bash'
-DSHELL -DHAVE_CONFIG_H -I. -I../bash -I../bash/include
-I../bash/lib -D_FORTIFY_SOURCE=2 -g -O2 -fstack-protector
--param=ssp-buffer-size=4 -Wformat -Wformat-security
-Werror=format-security -Wall
uname output: Linux se 3.2.0-26-generic #41-Ubuntu SMP Thu Jun 14
17:49:24 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux
Machine Type: x86_64-pc-linux-gnu
Bash Version: 4.2
Patch Level: 24
Release Status: release
Description:
Executing `cd //` will put you in the root directory as expected;
however executing `pwd` will report "//" as your working directory.
Also, if your Bash prompt has "$PWD" in it then it will also
report "//" as your working directory. This quirk appears only
with the Bash builtin version of `pwd`; the GNU Coreutil version of
`/bin/pwd` will report "/" as expected.
Also note that if you execute `cd ///` or `cd ////` or `cd /////`, etc...
then you will be put in the root directory and `pwd` will report "/"
as expected. In other words, this quirk appears only if you cd to "//".
Repeat-By:
#!/bin/bash
cd /
pwd
/usr/bin/pwd
cd //
pwd
/usr/bin/pwd
cd ///
pwd
/usr/bin/pwd
cd ////
pwd
/usr/bin/pwd
cd /////
pwd
/usr/bin/pwd
- "cd //" isn't the same as "cd /" or "cd ///",
Noah Spurrier <=