Trying to remove a file with a name of: -cr
If I do a "rm -i *" I get an error because it is trying to use the "-c" as
an option on the rm command.
Any ideas?
Thanks
If I do a "rm -i *" I get an error because it is trying to use the "-c" as
an option on the rm command.
Any ideas?
Thanks
CP> If I do a "rm -i *" I get an error because it is trying to use the "-c" as
CP> an option on the rm command.
Use '--' to indicate that there are no more command flags to
process:
$ ls -l -- -cr
-rw-r--r-- 1 ndronen food 0 Feb 26 17:11 -cr
$ rm -- -cr
$ ls -l -- -cr
ls: 0653-341 The file -cr does not exist.
--
"Why shouldn't I top-post?" http://www.aglami.com/tpfaq.html
"Meanings are another story." http://www.ifas.org/wa/glossolalia.html
> CP> If I do a "rm -i *" I get an error because it is trying to use the
> "-c" as CP> an option on the rm command.
> Use '--' to indicate that there are no more command flags to process:
> $ ls -l -- -cr
> -rw-r--r-- 1 ndronen food 0 Feb 26 17:11 -cr $ rm -- -cr
> $ ls -l -- -cr
> ls: 0653-341 The file -cr does not exist.
rm -i "-cr"
or
find . -name "-cr" -exec rm -f {} \;
> CP> If I do a "rm -i *" I get an error because it is trying to use the
"-c" as
> CP> an option on the rm command.
> Use '--' to indicate that there are no more command flags to
> process:
> $ ls -l -- -cr
> -rw-r--r-- 1 ndronen food 0 Feb 26 17:11 -cr
> $ rm -- -cr
> $ ls -l -- -cr
> ls: 0653-341 The file -cr does not exist.
> --
> "Why shouldn't I top-post?" http://www.aglami.com/tpfaq.html
> "Meanings are another story." http://www.ifas.org/wa/glossolalia.html
>> CP> If I do a "rm -i *" I get an error because it is trying to use the
cp> "-c" as
>> CP> an option on the rm command.
>> Use '--' to indicate that there are no more command flags to
>> process:
>> $ ls -l -- -cr
>> -rw-r--r-- 1 ndronen food 0 Feb 26 17:11 -cr
>> $ rm -- -cr
>> $ ls -l -- -cr
>> ls: 0653-341 The file -cr does not exist.
A few years of experience is usually enough to pick up useful
little tricks here and there.
Also, please don't top-post. (See URL below.) :-)
--
"Why shouldn't I top-post?" http://www.aglami.com/tpfaq.html
"Meanings are another story." http://www.ifas.org/wa/glossolalia.html
Incidentaly, trying rm -f * is very dangerous (because you can have
files with special characters on them).
Demo:
# echo > '-rf ..'
"rm *" will expand to "rm -rf .. remaining files"
To avoid this sort of expansion, rm won't touch '..', but the ingenuity
of fools is never to be underestimated.
Always: rm -- *
--
Doing AIX support was the most monty-pythonesque
activity available at the time.
Eagerly awaiting my thin chocolat mint.
IT in comp.unix.aix ,. And promptly posted it on the wall in the
Men's Room of Habib's Middle Eastern cafe and auto upholstry shop
vidi venci veniQuote:>Trying to remove a file with a name of: -cr
>If I do a "rm -i *" I get an error because it is trying to use the "-c" as
>an option on the rm command.
>Any ideas?
>Thanks
F R E E T I B E T
(Applies to first 2, all others at regular price)
1. How to delete file called '--preserve'
Here's a question for you gurus. I accidentally created a file
called '--preserve' and I can't delete the thing. No matter what
I do, Linux takes it as a switch to rm. Suggestions?
Randall
3. How to delete file called '-a'?
5. 'delete' command in ftp delete files in local hard disk ???
7. "rm: can't unlink 'files'",can't delete files
8. Need suggestion on ISP who can hook up my linux to Internet
9. Panasonic CR-563, CR-562 and IBM external CR-563 compatible.
10. grep <CR><CR> delimited lines in text file?
11. It's not bad canned meat...
12. about remove 'LF' but keep 'CR/LF'