funny characters in filenames

Guy Harris guy at rlgvax.UUCP
Sat Jul 30 07:40:26 AEST 1983


I just noticed that the original article included "." in the set of
anathematized characters.  Almost EVERY operating system in the world allows
"." in a file name, for obvious reasons; it's the character that has become
the conventional separator between file name and extension!  (Yes, I know about
systems like CTSS, ITS, etc. that do it with spaces.)  "/" was also included,
but depending on your point of view that is already absolutely forbidden in
file names (because it separates file names within a path name) or it must
be allowed in path names (because it separates...).  Any PROGRAM which forbade
the use of "/" and "." in file names would become very unpopular very quickly;
if you couldn't give "/etc/passwd" to an editor it wouldn't become a very
popular editor....  It's probably not wise to put restrictions on printable
ASCII characters in file names, because SOMEBODY out there might have to use
that character in a file name, or want to use it.  Hell, in our office
automation system (where the end-user interacts by filling in forms to provide
command arguments, so we don't need token separator characters) I frequently
create files with blanks in their name just because it's a more logical
separator than "_" or "-".

Most of the cases I've seen where a filename truly caused problems were cases
where a character had the eighth bit on or was a control character; only the
first can't be solved using the shell's quoting mechanism (ironically, it's
because that very quoting mechanism uses the eighth bit internally - in all
the major UNIX shells, I believe - to indicate quoted characters).  Files
with other characters don't cause problems for UNIX per se, just for users
using a shell that gives that character significance.  Just saying "if you
have to deal with a file which contains these characters in their name, remember
to put the name in quotes in the shell" should suffice for most of these
cases.  If the user isn't even using a standard UNIX shell the problem may
not even occur.  For programs, the problem either won't occur because you
aren't using something like "system" or, if you *really* need to use "system",
the problem can be prevented by using the same quote characters as you would
use when typing the command yourself.

	Guy Harris
	{seismo,mcnc,we13,brl-bmd,allegra}!rlgvax!guy



More information about the Comp.unix.wizards mailing list