How can I remove this file ?
David Piniella
dpiniell at newssun.med.miami.edu
Fri Apr 9 07:00:11 PDT 2004
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
More information about the freebsd-questions
mailing list