Cameron Kaiser wrote:
Except, in UNIX, one can have a completely *valid*
filename with
slashes in it. Or almost any other character in the system
character-set really.
Peace... Sridhar
Unix filenames can't have slashes in them (everything except slash and
null is allowed). All Unices that I know of would interpret a path with
slashes in it as a path with subdirectories, not a filename.
Oh really?
% touch \/path
% ls -l \/path
-rw-r--r-- 1 luser luser 0 Mar 3 17:55 /path
% pwd
/home/luser
% ls -l /path
ls: /path: No such file or directory
% rm \/path
% ls -l \/path
ls: /path: No such file or directory
Doesn't work for me as a regular user. I get:
$ touch \/path
touch: /path: Permission denied
As root, it works, but it creates a file called "path" in the root
directory, not a file called "/path" in the current directory. Escaping
the slash doesn't change its meaning, since the handling of slashes is
done by the kernel (or equivalent), not the shell (backslash only makes
the shell treat special characters as literal characters).