You do: rm ./-d
> Hi,
> I have a file named -d in my dir, if I type rm -d , it says illegal option.
> How can I remove this file ?
> Suhas
> --
> ---
> Suhas Mansingh
> Phone 613-763-6493 ESN 393-6493
You do: rm ./-d
> Hi,
> I have a file named -d in my dir, if I type rm -d , it says illegal option.
> How can I remove this file ?
> Suhas
> --
> ---
> Suhas Mansingh
> Phone 613-763-6493 ESN 393-6493
> > Hi,
> > I have a file named -d in my dir, if I type rm -d , it says illegal option.
> > How can I remove this file ?
> You do: rm ./-d
When stuff like that happens to me, I go into emacs (actually, I use
XEmacs) and do:
C-x d <directory-name-where-your-file-is>
and then go to that line, with the -d file, hit `d' for delete, and then
`x' for expunge, and it's gone.
dave
>> > Hi,
>> > I have a file named -d in my dir, if I type rm -d , it says illegal
option.
>> > How can I remove this file ?
>> You do: rm ./-d
>sometimes, that doesn't work so well. maybe it depends on the shell?
>When stuff like that happens to me, I go into emacs (actually, I use
>XEmacs) and do:
>C-x d <directory-name-where-your-file-is>
>and then go to that line, with the -d file, hit `d' for delete, and then
>`x' for expunge, and it's gone.
rm -- -d
Hope this helps.
The easiest way to do it is to use the file manager. You can change the name
to a valid name on the file manager & then remove it.
Prasanna
> > > Hi,
> > > I have a file named -d in my dir, if I type rm -d , it says illegal option.
> > > How can I remove this file ?
> > You do: rm ./-d
> sometimes, that doesn't work so well. maybe it depends on the shell?
> When stuff like that happens to me, I go into emacs (actually, I use
> XEmacs) and do:
> C-x d <directory-name-where-your-file-is>
> and then go to that line, with the -d file, hit `d' for delete, and then
> `x' for expunge, and it's gone.
> dave
>sometimes, that doesn't work so well. maybe it depends on the shell?
What shell do you use? Can you actually reproduce this failure?
--
GTE Internetworking, Powered by BBN, Cambridge, MA
Support the anti-spam movement; see <http://www.cauce.org/>
Please don't send technical questions directly to me, post them to newsgroups.
Hi,
besides rm ./-d, you can also use rm --d. The extra dash tells the shell
your using that it's not a switch.
Jared Perkins
Graphic Color Service
----------
The easiest way to do it is to use the file manager. You can change the name
to a valid name on the file manager & then remove it.
Prasanna
> > Hi,
> > I have a file named -d in my dir, if I type rm -d , it says illegal
option.
> > How can I remove this file ?
> You do: rm ./-d
When stuff like that happens to me, I go into emacs (actually, I use
XEmacs) and do:
C-x d <directory-name-where-your-file-is>
and then go to that line, with the -d file, hit `d' for delete, and then
`x' for expunge, and it's gone.
dave
Double dashes are mostly used for full-word switch names. E.g. most of the
GNU utilities support --help as a synonym for -h.
I think you may be thinking of:
rm -- -d
The standard option processing routines treat an argument consisting *only*
of "--" as the end of the options, so anything after it is a filename.
Since this depends on the command using a proper argument processing
routines, it may or may not work with any particular version of rm.
--
GTE Internetworking, Powered by BBN, Cambridge, MA
Support the anti-spam movement; see <http://www.cauce.org/>
Please don't send technical questions directly to me, post them to newsgroups.
this is a faq.
last time it popped up in unix groups, about last maonth.
i repeat some of the answers i remember:
rm -i * # answer y to -d file only
rm -- -d
rm ?d # beware of closely named files
rm ./-d
<go to the parent dir, then > rm such&such-dir/-d
<go to a subdir, then> rm ../-d
rm <fullpath>/-d
<use emacs dir mode>
till next month,
..
--
=-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
al aab, seders moderator sed u soon
it is not zat we do not see the s o l u t i o n
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-+
I suggest you be more selective, and only repeat the *correct* ones. IfQuote:>last time it popped up in unix groups, about last maonth.
>i repeat some of the answers i remember:
This won't work unless there are filenames with other punctuationQuote:>rm -i * # answer y to -d file only
rm -i -d <other files>
and the -d will be treated as an option rather than a filename.
This should work on many systems, but not all obey the '--' convention.Quote:>rm -- -d
Won't work. The shell will expand it to "rm -d" (assuming there are noQuote:>rm ?d # beware of closely named files
These should all work.Quote:>rm ./-d
><go to the parent dir, then > rm such&such-dir/-d
><go to a subdir, then> rm ../-d
>rm <fullpath>/-d
><use emacs dir mode>
The important thing to remember is that the shell processes wildcards,
quotes, and variables, while commands themselves process options and
arguments. By the time the command sees an argument, it has no idea
whether it was typed out or resulted from wildcard or variable expansion.
--
GTE Internetworking, Powered by BBN, Cambridge, MA
Support the anti-spam movement; see <http://www.cauce.org/>
Please don't send technical questions directly to me, post them to newsgroups.
>--------------E3786D0FF043015B2D8267C5
>Content-Type: text/plain; charset=us-ascii
>Content-Transfer-Encoding: 7bit
>The easiest way to do it is to use the file manager. You can change the name
>to a valid name on the file manager & then remove it.
*BING*...
-Chris
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
4. passwords
5. How to delete file called '-a'?
6. Looking for XF86Config for a Diamond SpeedStar
7. can't delete a file called -cr
9. How to delete a file that is called "."
10. 'delete' command in ftp delete files in local hard disk ???
11. Need utility to trap network function calls (socket calls) and save to log file
12. recover deleted file in hp-ux ( vxfs file system)
13. Deleting Files Without Worrying about : Overriding Protection Of Your File