Results 1 to 3 of 3
I am trying to move a file that starts with "-" with mv. Whenever I try to move it I get an error saying I have an invalid option because ...
- 06-12-2007 #1Linux Newbie
- Join Date
- Oct 2006
- Posts
- 101
renaming a file starting with -
I am trying to move a file that starts with "-" with mv. Whenever I try to move it I get an error saying I have an invalid option because the file starts with -. I have tried to put a \ before it with no luck and I have tried quotes. Thanks in advance!
--Erik
- 06-12-2007 #2Linux Guru
- Join Date
- Nov 2004
- Posts
- 6,110
There is an old GNU trick that if you want to specify the end of switches you can pass a double hypen '--' with no action after it -
Escaping doesn't usually work, nor do quotes. Just use the double hyphen.Code:mv -- -somefile somefile
- 06-12-2007 #3Linux Newbie
- Join Date
- Oct 2006
- Posts
- 101
worked great, thanks!
--Erik


Reply With Quote
