Re: [ILUG] Deleting a file with a "--" prefix

From: Chris Higgins (chris.higgins at domain horizon.ie)
Date: Wed 23 May 2001 - 09:32:59 IST


>
> Hi all,
>
> Quick question for you all: how can I delete from the console a file called
> "--preserve-permissions" that some twit created. Neither "rm" nor "mv"
> will work as standard as they both assume that I am trying to pass some
> option.

You could try 'rm -i *' if your version of 'rm' isn't new... or

From man pages :

       GNU rm, like every program that uses the getopt function
       to parse its arguments, lets you use the -- option to
       indicate that all following arguments are non-options. To
       remove a file called `-f' in the current directory, you
       could type either
              rm -- -f
       or
              rm ./-f
       The Unix rm program's use of a single `-' for this purpose
       predates the development of the getopt standard syntax.

This second option is the preferred one... it's far too easy to
forget the '-i' in the first (which is why people have a tendancy
to create files called -i all over the place...)

>
> Thanks,
>
> Ruairi
>
>
>
> --
> Irish Linux Users' Group: ilug at domain linux.ie
> http://www.linux.ie/mailman/listinfo/ilug for (un)subscription information.
> List maintainer: listmaster at domain linux.ie

-- 
** Chris Higgins                         e: chris.higgins at horizon.ie **
** Technical Business Development        tel: +353-1-6204916            **
** Horizon Technology Group              fax: +353-1-6204949            **


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