tags:

views:

230

answers:

2

How do you get a / into a filename (i.e., a / that doesn't separate components of the path)?

+33  A: 

You don't. Slashes are not allowed in UNIX filenames.

anon
Short. Succinct. Correct. I can't compete with that. +1. Of course, you could edit the directory files themselves but only $DEITY knows what havoc that would cause.
paxdiablo
If one is only interested in the approximate look, then U+2044, U+2215 or U+FF0F might be options. But I think this would be considerably frowned upon by UNIX people.
Joey
Yes, it would be frowned upon. I still hunt down people who use spaces in their file names and beat them senseless with a wet stick of celery (takes a while but it's enjoyable). Unicode characters would make me livid. :-)
paxdiablo
Reminds me of my favorite unix-noob haze: cd; echo >"-r -f *" ... just be kind and backup there home directory first.
corlettk
@corlettk: this is why I have files called "-i" in strategic positions on my fs
Hasturkun
The reason why i asked this question at all is:This is a question on page 79 in the book "the unix programming environment"the only way i can think of is to mess up with the directory entries in the disk block device.however, since the authors stated clearly this was a trick question.i assume there's a smarter solution.
James Geng
By "trick question" I think they meant there isn't a solution.
anon
you're probably right.it reminds me of one of interview questions"write a function/method to swap two integers in java"
James Geng
A: 

Iam burning to hear why you want to do this?

codymanix
this is a question in the book "the unix programming environment".just curious how it's even possible.
James Geng
But if it would ber possible what could the system handle ambiguities?For example the folder /a/b could be a folder "a" which contains a subfolder "b" or a folder named "a/b" in the root directory.
codymanix