[ILUG] Re: deleting file called '--exclude'

From: Paul Mc Auley (pmcauley at domain baltimore.com)
Date: Tue 11 Jul 2000 - 09:51:18 IST


On Tue, 11 Jul 2000 09:38:29 +0100
"Guest, Ken" <kengu at domain credo.ie> wrote:

| I don't know how I managed it, but I have a rather large
| file on styx named "--exclude".
| Any attempt to rm it or mv it to a deletable file name
| results in the program stating something along the lines of
| 'option not supported'.
| I've tried quoting the filename, using multichar wildcards (*)
| and singlechar wildcards (?) to no avail.

| Does anybody have suggestions on how I can delete this file?

[Googles for the FAQ]
1) How do I remove a file whose name begins with a "-" ?

    Figure out some way to name the file so that it doesn't
    begin with a dash. The simplest answer is to use

            rm ./-filename

    (assuming "-filename" is in the current directory, of course.)
    This method of avoiding the interpretation of the "-" works
    with other commands too.

    Many commands, particularly those that have been written to use
    the "getopt(3)" argument parsing routine, accept a "--" argument
    which means "this is the last option, anything after this is not
    an option", so your version of rm might handle "rm -- -filename".
    Some versions of rm that don't use getopt() treat a single "-"
    in the same way, so you can also try "rm - -filename".
        Paul



This archive was generated by hypermail 2.1.6 : Thu 06 Feb 2003 - 13:06:50 GMT