[Tutor] valid filenames

Lloyd Hugh Allen lha2@columbia.edu
Mon, 02 Apr 2001 18:50:15 -0400


> Message: 15
> Date: Mon, 2 Apr 2001 17:26:35 -0400
> From: D-Man <dsh8290@rit.edu>
> To: tutor@python.org
> Subject: Re: [Tutor] valid filenames
> 
> On Sun, Apr 01, 2001 at 12:37:24PM -0400, Rick Pasotto wrote:
> | On Sun, Apr 01, 2001 at 09:24:06AM -0700, Sheila King wrote:
> | > On Sun, 1 Apr 2001 17:02:57 +0200, lumbricus@gmx.net  wrote about Re:
> | > [Tutor]
> | > valid filenames:
> | >
> | > :U can avoid by not using
> | > :names like -anything
> | > :           ^
> | >
> | > The hyphen is not that uncommon in file names on Unix. For example,
> | > Qmail expects hyphens in the .qmail filenames that can be used for
> | > filtering email on the RCPT field of the email envelope, and from
> | > there invoking scripts or forwarding to other addresses or whatever.
> |
> | The only problem with a hyphen is when it's the first character of the
> | file name. Doing that causes many commands to confuse it with an option
> | and special steps have to be taken to get around that.
> 
> For example, try to remove that file :
> 
> $ rm -anything
> 
> rm: illegal option -- a
> rm: illegal option -- n
> rm: illegal option -- y
> rm: illegal option -- t
> rm: illegal option -- h
> rm: illegal option -- n
> rm: illegal option -- g
> usage: rm [-fiRr] file ...
> 
> It wasn't even able to tell me the file DNE.

I was going to write that it would be a really bad idea to name a file
'-rf ~&', but then I was afraid that someone would actually try it. A
friend from undergrad used to have the .finger file

[10]  rm -rf ~ done

or however it would look (don't have access to unix at the moment).