I have created a directory named -
[root@server50 public_html]# mkdir -
[root@server50 public_html]# ls -al
drwxr-xr-x 2 root root 4096 2011-03-16 02:22 -
How can I enter the directory using 'cd' command.
I have created a directory named -
[root@server50 public_html]# mkdir -
[root@server50 public_html]# ls -al
drwxr-xr-x 2 root root 4096 2011-03-16 02:22 -
How can I enter the directory using 'cd' command.
Look up the man page for cd
and you see that a command-line argument consisting of a single hyphen is treated as a $OLDPWD variable. To prevent this from happening, you simply need to replace the "single hyphen" with more information from its path: Some ways to do this are:
cd /full/path/to/-
cd ./-
cd ././-
Anything so that a single hyphen "-" by itself does not appear on the command line, otherwise it will be interpreted as the old-working-directory