can't work with a file starting with dash space '- ' ?

Yuri Pankov yuri.pankov at gmail.com
Fri Jan 16 02:38:14 PST 2009


On Fri, Jan 16, 2009 at 10:33:13AM +0000, Anton Shterenlikht wrote:
> By mistake I saved an email attachmed as it was called, probably
> from MS world:
> - Reviewer Comments - FFEMS - Closure paper.pdf
> 
> Now I cannot delete, or rename it.
> 
> % cp -\ Reviewer\ Comments\ -\ FFEMS\ -\ Closure\ paper.pdf z
> cp: illegal option --  
> usage: cp [-R [-H | -L | -P]] [-f | -i | -n] [-lpv] source_file target_file
>        cp [-R [-H | -L | -P]] [-f | -i | -n] [-lpv] source_file ... target_directory
> % rm -\ Reviewer\ Comments\ -\ FFEMS\ -\ Closure\ paper.pdf 
> rm: illegal option --  
> usage: rm [-f | -i] [-dIPRrvW] file ...
>        unlink file
> % 
> 
> I can view it with xpdf, but that's about all.
> I tried wildcards and quotes, sh, csh, bash, tcsh and superuser but no luck.
> 
> How can I delete or rename this file?
> 
> many thanks
> anton
> 
> -- 
> Anton Shterenlikht
> Room 2.6, Queen's Building
> Mech Eng Dept
> Bristol University
> University Walk, Bristol BS8 1TR, UK
> Tel: +44 (0)117 928 8233 
> Fax: +44 (0)117 929 4423


Try cp/rm -- <filename-with-dashes>
-- here denotes the end of command options.


HTH,
Yuri


More information about the freebsd-questions mailing list