Re: [Hampshire] how do I delete a file named -n

Top Page

Reply to this message
Author: Gordon Scott
Date:  
To: Hampshire LUG Discussion List
Subject: Re: [Hampshire] how do I delete a file named -n
On Fri, 2 Feb 2007, Simon Reap wrote:

> rm nosuch_file -n
>
> 'rm' is one of the many commands which, as soon as it sees something on
> the command line that isn't an option, assumes that the rest of the line
> contains file names. This will complain about not finding nosuch_file
> (assuming that it doesn't exist!), but it will still go on to delete the
> '-n' file.


I suggest caution with that philosopy.
I know from bitter experience that there is more than one implementation
of many unix commands and they don't always behave the same.

Thinking about bu earlier post, which was really focussing on the -i for
safety rather than the ?n, probably the ?n should be "?n", which would
force many versions of unix command to do the globbing again themselves.

G.

-- 
Gordon Scott                  http://www.gscott.co.uk


        Linux ... Because I like to *get* there today.