filenames starting with a '-'

Top Page
Attachments:
Message as email
+ (text/plain)
Delete this message
Reply to this message
Author: Jasonjkenner@mindspring.com
Date:  
Subject: filenames starting with a '-'
wrote:
>
> \_ There's a couple different ways to do it:
> \_
> \_ 1) cp -- -001 /wherever
> \_ or
> \_ 2) cp ./-001 /whereever
>
> 3) cp ?001 /wherever
> 4) cp *01 /wherever
>
> shell expansions/wildcards are your friends.
>
> \_ The same format should work with rm and mv too.
>
> YMMV on different unices passing a --


Shell expansions result in the error:

slick:~$ echo > ./-001
slick:~$ ls -001
/bin/ls: illegal option -- 0
Try `/bin/ls --help' for more information.
slick:~$ cp -001 blah
cp: illegal option -- 0
Try `cp --help' for more information.
slick:~$ cp ?001 blah
cp: illegal option -- 0
Try `cp --help' for more information.
slick:~$ cp ./?001 blah
slick:~$ ls ?001
/bin/ls: illegal option -- 0
Try `/bin/ls --help' for more information.
slick:~$ ls ./-001
./-001


-- 
jkenner @ mindspring . com__
I Support Linux:           _> _  _ |_  _  _     _|
Working Together To       <__(_||_)| )| `(_|(_)(_|
To Build A Better Future.       |                   <s>