hayne
04-19-2005, 03:22 PM
To use Unix command on a file whose name starts with a dash (-), you need to use the full path to the file.
E.g. refer to the file as: ./-z
so to rename it: mv ./-z foo
Of course you could also just use Finder to rename it.
voldenuit
04-19-2005, 03:28 PM
in really screwed-up cases, you can use ls -i to find out the inode-number of the file in question, then use find to delete it.
But hayne's suggestions should take care of the everyday-cases.
teknovision
04-19-2005, 03:52 PM
De-pickled, thank you both so much!!
Another method is the I'm done with switches switch:
mv -- -z file-z
slacker
04-19-2005, 07:27 PM
There are at least 2K+1 answers, where K is the number of Unix geeks in the discussion...
For printable characters, you can always backslash the character:
mv \-z foo
For really wacky stuff, you can use dired mode in EMACS!
emacs .
where . means current directory.
hayne
04-19-2005, 08:15 PM
For printable characters, you can always backslash the character:
mv \-z foo
That doesn't work.
Try it:
touch "-z"
mv \-z foo
slacker
04-20-2005, 12:18 AM
I stand corrected. I completely forgot that - at start of line is the exception because of stdarg processing. -- is the simplest solution..