command:
cd -
This will take you to the previous directory you were in. I find this
very useful as a short cut to go back and forth. I thought then what
happens if you name a directory -. It turns out, you will have a lot of
trouble on the command line changing into such a named directory.
I talked to people on the #bash channel on freenode and they were also
surprised. Normally, you could use -- to a command in order to tell it
that "hey, the options are over with, the rest of the arguments are not
options", but
So here are a list of ways that don't work for getting into the -
directory. Unless of course your previous directory was the - directory:
cd -
cd -/
cd '-'
cd "-"
cd '\-'
cd "\-"
cd \-
cd \-/
cd \\-/ (Tries to go to a directory called \- (go figure)
cd -- -
cd -- -/
The following will work:
cd /full/path/to/-
cd ./-
cd ./-/
cd ~/to/- (if its a subdir of your homedir)
Of course, I was able to delete the empty - dir by simply running
rmdir -
Lesson learned, don't name directories -
--
Mark Krenz
Bloomington Linux Users Group
http://www.bloomingtonlinux.org/
_______________________________________________
BLUG mailing list
BLUG@linuxfan.com
http://mailman.cs.indiana.edu/mailman/listinfo/blug
No comments:
Post a Comment