Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 09 Apr 2004 10:02:27 -0400
From:      David Piniella <dpiniell@newssun.med.miami.edu>
To:        Erik Trulsson <ertr1013@student.uu.se>, freebsd-questions@freebsd.org
Subject:   Re: How can I remove this file ?
Message-ID:  <4076ACF3.5030203@newssun.med.miami.edu>
In-Reply-To: <20040409115034.GA57507@falcon.midgard.homeip.net>
References:  <20040409114035.40752.qmail@web40604.mail.yahoo.com> <20040409115034.GA57507@falcon.midgard.homeip.net>

next in thread | previous in thread | raw e-mail | index | archive | help
Erik Trulsson wrote:

>On Fri, Apr 09, 2004 at 12:40:35PM +0100, Supote Leelasupphakorn wrote:
>  
>
>>Hi lists
>>
>>  How can I delete file named prefix with "-" ?
>>    
>>
>
>If you had bothered to read the manpage for rm(1) you would already
>know that since the following paragraph appears there:
>
>   The rm command uses getopt(3) to parse its arguments, which allows it to
>   accept the --' option which will cause it to stop processing flag
>   options at that point.  This will allow the removal of file names that
>   begin with a dash (-').  For example:
>         rm -- -filename
>   The same behavior can be obtained by using an absolute or relative path
>   reference.  For example:
>         rm /home/user/-filename
>         rm ./-filename
>
>
>
>  
>
I've never run across that.

% cd tmp
% ls
% touch -
% ls
-
% rm -
% ls
%

although if it was giving you trouble, I suppose you could do a
rm ./\-

-- 
David Piniella
University of Miami




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4076ACF3.5030203>