bug-fileutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: RM command - bug report


From: Bob Proulx
Subject: Re: RM command - bug report
Date: Wed, 5 Jun 2002 10:15:17 -0600
User-agent: Mutt/1.3.28i

> I've got a file named "-------Message".
> 
> When i want to remove this file with the rm command like this :    rm 
> -------Message    or    rm "-------Message"    or    rm '-------Message'    
> or    rm \-\-\-\-\-\-\-Message

First off you are confusing shell quoting with command line options.
Those two are not related in any way.  Put that out of your head right
now because it will only further confuse you with other commands.  Use
the 'echo' command to see what the 'rm' program is seeing.

  echo rm "-------Message"
  rm -------Message

Quoting protects the contents of the string from the shell expanding
any file wildcards (shell metacharacters).  You don't have any there
and therefore quoting won't do anything obvious.  To see what quoting
does look at the differences in these next two commands.

  echo "*"

Versus:

  echo *

> the command failed cause it thinks that -------Message is an option !

Command options start with a '-' and therefore -------Message looks
like an option command.  Therefore you must make the filename passed
to the command not look like an option.  Here is an FAQ entry on this
topic.

  
http://www.gnu.org/software/fileutils/doc/faq/core-utils-faq.html#How%20do%20I%20remove%20files%20that%20start%20with%20a%20'-'%20such%20as%20'-i'%3f

> Could you tell me how i can remove this file ?

The 'rm --help' messages from version 4.1 and later say this:

    To remove a file whose name starts with a `-', for example `-foo',
    use one of these commands:
      rm -- -foo

      rm ./-foo

HTH
Bob



reply via email to

[Prev in Thread] Current Thread [Next in Thread]