[Bendug] file name oddities
Kenny Thorn
Kenny at smartz.com
Sat Feb 18 17:17:16 PST 2006
kthorn at centauri kthorn $ echo "test" > test
kthorn at centauri kthorn $ mv test -test
kthorn at centauri kthorn $ ls -la -test
ls: illegal option -- e
usage: ls [-1ACFLRSTWacdfiklmnopqrstux] [file ...]
kthorn at centauri kthorn $ ls -la -- -test
-rw-r--r-- 1 kthorn kthorn 5 Feb 18 17:15 -test
kthorn at centauri kthorn $ mv -- -test test
kthorn at centauri kthorn $ ls -la test
-rw-r--r-- 1 kthorn kthorn 5 Feb 18 17:15 test
The "--" trick will work for most uses.
/krt
-----Original Message-----
From: bendug-bounces at lists.bendtel.net
[mailto:bendug-bounces at lists.bendtel.net] On Behalf Of Tim Howe
Sent: Saturday, February 18, 2006 1:13 PM
To: bendug at lists.bendtel.net
Subject: [Bendug] file name oddities
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.
--TimH
More information about the Bendug
mailing list