rename directory that has leading - in name

Nils Kassube kassube at gmx.net
Sun Aug 17 06:23:46 UTC 2008


chuck adams wrote:
> in bash:
>
> how do you escape the - if it is the leading character in a file
> or directory name.
>
> I tried
>
> mv -name newname  with
>
> mv "-name" newname
> mv '-name' newname
> mv \-name newname

I can think of 2 versions:

mv -- -name newname

or

mv ./-name newname

The problem is that anything starting with "-" is considered an option 
parameter by most programs. Many (all?) of them accept "--" as an "end of 
options" parameter.


Nils




More information about the kubuntu-users mailing list