how to delete a file called -d

how to delete a file called -d

Post by Jorge Cana » Wed, 21 Jan 1998 04:00:00



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

 
 
 

how to delete a file called -d

Post by David Bakhas » Mon, 26 Jan 1998 04:00:00



> > 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

 
 
 

how to delete a file called -d

Post by John R. Aki » Thu, 29 Jan 1998 04:00:00




>> > 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.

An easier way to do this is to use the '--' flag, described in the man page
for rm, as follows:

    rm -- -d

Hope this helps.

 
 
 

how to delete a file called -d

Post by T.R. Prasann » Fri, 30 Jan 1998 04:00:00


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

 
 
 

how to delete a file called -d

Post by Barry Margoli » Tue, 03 Feb 1998 04:00:00





>> You do:   rm ./-d

>sometimes, that doesn't work so well.  maybe it depends on the shell?

If it doesn't work, something is very wrong.  The shell should leave names
like that alone.

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.

 
 
 

how to delete a file called -d

Post by Jared Perkin » Tue, 03 Feb 1998 04:00:00


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

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    

 
 
 

how to delete a file called -d

Post by Barry Margoli » Tue, 03 Feb 1998 04:00:00




>besides rm ./-d, you can also use rm --d.  The extra dash tells the shell
>your using that it's not a switch.

No it doesn't.  Switches aren't even processed by the shell.

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.

 
 
 

how to delete a file called -d

Post by Al A » Wed, 04 Feb 1998 04:00:00


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          
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-+

 
 
 

how to delete a file called -d

Post by Barry Margoli » Wed, 04 Feb 1998 04:00:00



>this is a faq.

It's almost certainly the #1 FAQ.  It may even be the original reason why
FAQ files were created.  And it's in the FAQ that's posted to this
newsgroup every month.  And since FAQ postings are supposed to prevent
people from asking the same questions over and over, we should never see
this question again. :-(

Quote:>last time it popped up in unix groups, about last maonth.
>i repeat some of the answers i remember:

I suggest you be more selective, and only repeat the *correct* ones.  If
you're not sure, try them.  However, if you understand how things work, it
should be obvious which ones are correct and which are not.  If you can't
figure it out, maybe you shouldn't be the one answering questions.  (I
don't mean to be rude, but the amount of misinformation on this simple
subject is excessive, and I condone anything that can be done to reduce
it.)

Quote:>rm -i *   # answer y to -d file only

This won't work unless there are filenames with other punctuation
characters in the directory.  If not, the shell will expand it to

rm -i -d <other files>

and the -d will be treated as an option rather than a filename.

Quote:>rm -- -d

This should work on many systems, but not all obey the '--' convention.

Quote:>rm    ?d  # beware of closely named files

Won't work.  The shell will expand it to "rm -d" (assuming there are no
other two-character filenames ending in 'd'), and the rm program will treat
-d as an option.

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>

These should all work.

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.

 
 
 

how to delete a file called -d

Post by Kaz Kylhe » Thu, 12 Feb 1998 04:00:00




>--------------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.

What file manager? Oh you mean that one described int the POSIX.2 standard.

*BING*...

 
 
 

how to delete a file called -d

Post by Sitaram Chamar » Sun, 15 Feb 1998 04:00:00


rm ./-d

 
 
 

how to delete a file called -d

Post by Theo Lutgeri » Sat, 14 Mar 1998 04:00:00


: rm ./-d
rm - -d

 
 
 

how to delete a file called -d

Post by Chris Mikkelso » Sat, 14 Mar 1998 04:00:00




> : rm ./-d
> rm - -d

rm ./-d is more portable.  It will work on anything that
quacks even remotely like a UNIX.

-Chris