On Tue, 5 Nov 2002, Mark Courtney wrote:
> Can someone please tell me what "Special" characters can not be used in
> directory names?
>
> Here's what I have found from experimentation:
> ~ - tilde
> ` - backtick
> ! - exclamation
> / - duh
Okay, I don't have any definitive list of ones that do or don't work, but
I managed to get all but '/' by escaping the characters with backslash
(\):
$ mkdir \~hi
$ mkdir \`hi
$ mkdir \!hi
$ ls -l
drwxrwxr-x 2 jima jima 4096 Nov 5 06:41 `hi
drwxrwxr-x 2 jima jima 4096 Nov 5 06:41 ~hi
drwxrwxr-x 2 jima jima 4096 Nov 5 06:41 !hi
$ mkdir \/hi
mkdir: cannot create directory `/hi': Permission denied
$ mkdir h\/i
mkdir: cannot create directory `h/i': No such file or directory
It was worth a shot. To be honest, though, I suspect pretty much
anything besides '/' can be used, so long as you escape it.
On second thought, it looks like quoting the directory name with single
quotes works, too:
$ rmdir '`hi'
Double quotes work for most:
$ rmdir "~hi"
But not exclamation:
$ rmdir "!hi"
bash: !hi: event not found
$ rmdir '!hi'
I imagine these rules are somewhat shell-specific (I used bash, as
illustrated by that last error). They almost undoubtedly apply to files,
too.
Not exactly what you were looking for, but it's a hint.
Jima