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

Top Page
Author: Hugo Mills
Date:  
To: Hampshire LUG Discussion List
Subject: Re: [Hampshire] how do I delete a file named -n

Reply to this message
gpg: failed to create temporary file '/var/lib/lurker/.#lk0x5773c100.hantslug.org.uk.16310': Permission denied
gpg: keyblock resource '/var/lib/lurker/pubring.gpg': Permission denied
gpg: Signature made Wed Jan 31 20:36:29 2007 GMT
gpg: using DSA key B2C27BC21C335860
gpg: Can't check signature: No public key
On Wed, Jan 31, 2007 at 08:25:15PM +0000, Will Davies wrote:
> I must confess on this occasion I forgot to google so I appologise and
> thanks for reminding me. I suppose the interesting thing about asking a
> group of real people is the diversity in the answers you receive. This
> also helps in building background knowledge. Using google I probably
> would have found the first working solution and stopped. This way as
> well as the suggestion to include the path first I also learnt that --
> ends the command options.
>
> So thank you very much to all of you for your suggestions. BTW rm ?n
> does not work for me.


This is because the shell will expand the wildcard first, before
passing the expanded list to the rm command, so the shell sees:

rm ?n

then checks the directory for matching files, finds one called "-n",
and then executes the command:

rm -n

You have a similar problem trying to quote away the problem (using
rm '-n', say) -- the quoting is a shell thing, and you end up with "rm
-n" again.

Hugo.

-- 
=== Hugo Mills: hugo@... carfax.org.uk | darksatanic.net | lug.org.uk ===
  PGP key: 1C335860 from wwwkeys.eu.pgp.net or http://www.carfax.org.uk
              --- Python is executable pseudocode; perl ---              
                        is executable line-noise.