[Bendug] file name oddities

larry price laprice at gmail.com
Sat Feb 18 17:58:58 PST 2006


On 2/18/06, Tim Howe <thowe at bendtel.net> wrote:
> I ran into an issue today that was a bit odd.  I downloaded a file that began with a dash (-) character.  Several standard programs choked on it because it was being misinterpreted as a command line flag.  I tried enclosing it in single and double quotes.  I tried escaping the first dash.  Nothing was working.  I couldn't even rename it because mv was hainv the same issue.  Finally I got tired of dealing with it, connected to my local ftp server and renamed it through FTP!
>
> I'm wondering if anybody has seen stuff like this.  Sometimes parens and brackets have odd effects too, but they are generally easy to get around.
>
> I'm using OpenBSD, so I'm not sure if the Linux equivalent programs have the same issues...
>
> I'm thinking of updating my file name normalizing script (I use it for files in web directories) to get rid of crap like this.  Did I miss some obvious solution?  For some reason I think I did.


Most gnu programs will recognize -- as an option to end options...

$ echo "bar" > -foo
$ cat -- -foo
bar
$ mv -- -foo bar


More information about the Bendug mailing list