Hi,
I've got an odd situation here. Somehow, I find myself with two files that start with the - character. [eric@apollo mysql]$ ls -l total 93348 -rw-r--r-- 1 mysql mysql 9273344 Nov 13 19:03 -N=2007-11-08 -rw-r--r-- 1 mysql mysql 38879232 Nov 13 19:02 --newer=2007-11-08
Don't ask how they were created; something went wrong with a script at some point.
My problem is that I am trying to delete them, but can't figure out how to delete these files. Everything I try, I get the same msg: [eric@apollo mysql]$ rm '-N=2007-11-08' rm: invalid option -- N Try `rm --help' for more information.
I have tried single quotes, double quotes, escaping it with a \ and still get the same error.
Any ideas / suggestions?
Thanks!
Eric
On Tue, 22 Jan 2008, Eric B. wrote:
Hi,
I've got an odd situation here. Somehow, I find myself with two files that start with the - character. [eric@apollo mysql]$ ls -l total 93348 -rw-r--r-- 1 mysql mysql 9273344 Nov 13 19:03 -N=2007-11-08 -rw-r--r-- 1 mysql mysql 38879232 Nov 13 19:02 --newer=2007-11-08
Don't ask how they were created; something went wrong with a script at some point.
My problem is that I am trying to delete them, but can't figure out how to delete these files. Everything I try, I get the same msg: [eric@apollo mysql]$ rm '-N=2007-11-08' rm: invalid option -- N Try `rm --help' for more information.
I have tried single quotes, double quotes, escaping it with a \ and still get the same error.
Any ideas / suggestions?
rm ./-N=2007-11-08 ./--newer=2007-11-08
Benjamin Franz wrote:
On Tue, 22 Jan 2008, Eric B. wrote:
Hi,
I've got an odd situation here. Somehow, I find myself with two files that start with the - character. [eric@apollo mysql]$ ls -l total 93348 -rw-r--r-- 1 mysql mysql 9273344 Nov 13 19:03 -N=2007-11-08 -rw-r--r-- 1 mysql mysql 38879232 Nov 13 19:02 --newer=2007-11-08
Don't ask how they were created; something went wrong with a script at some point.
My problem is that I am trying to delete them, but can't figure out how to delete these files. Everything I try, I get the same msg: [eric@apollo mysql]$ rm '-N=2007-11-08' rm: invalid option -- N Try `rm --help' for more information.
I have tried single quotes, double quotes, escaping it with a \ and still get the same error.
Any ideas / suggestions?
rm ./-N=2007-11-08 ./--newer=2007-11-08
Or, from the "rm" man page:
To remove a file whose name starts with a ‘-’, for example ‘-foo’, use one of these com- mands:
rm -- -foo
rm ./-foo
On Tue, Jan 22, 2008 at 11:46:57AM -0500, Eric B. enlightened us:
I've got an odd situation here. Somehow, I find myself with two files that start with the - character. [eric@apollo mysql]$ ls -l total 93348 -rw-r--r-- 1 mysql mysql 9273344 Nov 13 19:03 -N=2007-11-08 -rw-r--r-- 1 mysql mysql 38879232 Nov 13 19:02 --newer=2007-11-08
Don't ask how they were created; something went wrong with a script at some point.
My problem is that I am trying to delete them, but can't figure out how to delete these files. Everything I try, I get the same msg: [eric@apollo mysql]$ rm '-N=2007-11-08' rm: invalid option -- N Try `rm --help' for more information.
I have tried single quotes, double quotes, escaping it with a \ and still get the same error.
Any ideas / suggestions?
rm -- -N=2007-11-08
The -- tells (most?) programs to stop processing options. This is listed as an example in the rm man page, so you should know that, right? I mean, you *did* read the man page....
Matt
On 23/01/2008, at 3:51 AM, Matt Hyclak wrote:
The -- tells (most?) programs to stop processing options. This is listed as an example in the rm man page, so you should know that, right? I mean, you *did* read the man page....
This reminds me of a quote that always makes me laugh:
"Interestingly, most Unix utilities have a command line option which will cause the system to rip the user's legs off and beat them to death with the soggy ends. This is often the default behaviour." -- Bruce Murphy
-- Steven Haigh
Email: netwiz@crc.id.au Web: http://www.crc.id.au Phone: (03) 9001 6090 - 0412 935 897
My problem is that I am trying to delete them, but can't figure out how to delete these files. Everything I try, I get the same msg: [eric@apollo mysql]$ rm '-N=2007-11-08' rm: invalid option -- N Try `rm --help' for more information.
I have tried single quotes, double quotes, escaping it with a \ and still get the same error.
Any ideas / suggestions?
rm -- -N=2007-11-08
The -- tells (most?) programs to stop processing options. This is listed as an example in the rm man page, so you should know that, right? I mean, you *did* read the man page....
Actually, yes - I have read the man page for rm many times before, but I guess I just missed / forgot that section. To be honest, I had no idea that -- will tell most programs to stop processing options.
Of course, now that everyone has spelled it out for me, I went back to the man page and it was plainly obvious.
Thanks again!
Eric
On Jan 22, 2008 11:46 AM, Eric B. ebenze@hotmail.com wrote:
Hi,
I've got an odd situation here. Somehow, I find myself with two files that start with the - character. [eric@apollo mysql]$ ls -l total 93348 -rw-r--r-- 1 mysql mysql 9273344 Nov 13 19:03 -N=2007-11-08 -rw-r--r-- 1 mysql mysql 38879232 Nov 13 19:02 --newer=2007-11-08
Don't ask how they were created; something went wrong with a script at some point.
My problem is that I am trying to delete them, but can't figure out how to delete these files. Everything I try, I get the same msg: [eric@apollo mysql]$ rm '-N=2007-11-08' rm: invalid option -- N Try `rm --help' for more information.
I have tried single quotes, double quotes, escaping it with a \ and still get the same error.
Any ideas / suggestions?
Thanks! Eric
Try "rm -- filename" That's two dashes, then a space. That tells 'rm' not to process any more arguments and switches and treat them as files.
On Jan 22, 2008 8:46 AM, Eric B. ebenze@hotmail.com wrote:
Hi,
I've got an odd situation here. Somehow, I find myself with two files that start with the - character. [eric@apollo mysql]$ ls -l total 93348 -rw-r--r-- 1 mysql mysql 9273344 Nov 13 19:03 -N=2007-11-08 -rw-r--r-- 1 mysql mysql 38879232 Nov 13 19:02 --newer=2007-11-08
Don't ask how they were created; something went wrong with a script at some point.
My problem is that I am trying to delete them, but can't figure out how to delete these files. Everything I try, I get the same msg: [eric@apollo mysql]$ rm '-N=2007-11-08' rm: invalid option -- N Try `rm --help' for more information.
I have tried single quotes, double quotes, escaping it with a \ and still get the same error.
Any ideas / suggestions?
Thanks!
Eric
The manpage is your friend:
To remove a file whose name starts with a '-', for example '-foo', use one of these commands:
rm -- -foo
rm ./-foo
On 23/01/2008, at 3:46 AM, Eric B. wrote:
Hi,
I've got an odd situation here. Somehow, I find myself with two files that start with the - character. [eric@apollo mysql]$ ls -l total 93348 -rw-r--r-- 1 mysql mysql 9273344 Nov 13 19:03 -N=2007-11-08 -rw-r--r-- 1 mysql mysql 38879232 Nov 13 19:02 --newer=2007-11-08
Don't ask how they were created; something went wrong with a script at some point.
My problem is that I am trying to delete them, but can't figure out how to delete these files. Everything I try, I get the same msg: [eric@apollo mysql]$ rm '-N=2007-11-08' rm: invalid option -- N Try `rm --help' for more information.
I have tried single quotes, double quotes, escaping it with a \ and still get the same error.
You can put -- after the rm command to tell it that everything after that is an arguement (I think).
ie: $ echo > --help $ ls -l -- *help* -rw-rw-r-- 1 netwiz netwiz 1 Jan 23 03:51 --help $ rm -f -- --help $ ls -l -- *help* ls: *help*: No such file or directory $
-- Steven Haigh
Email: netwiz@crc.id.au Web: http://www.crc.id.au Phone: (03) 9001 6090 - 0412 935 897
Eric B. wrote:
Hi,
I've got an odd situation here. Somehow, I find myself with two files that start with the - character. [eric@apollo mysql]$ ls -l total 93348 -rw-r--r-- 1 mysql mysql 9273344 Nov 13 19:03 -N=2007-11-08 -rw-r--r-- 1 mysql mysql 38879232 Nov 13 19:02 --newer=2007-11-08
rm -- --newer=2007-11-08 rm -- -N=2007-11-08 That is rm space dash dash space then the filename.
Garl