I've just encounter the following question in Unix Programming Environment, the Kernighan and Pike's classic book on Unix (I found the below text on p. 79 of year 1984 edition, ISBN:0-13-937699-2):
Exercise 3-6. (Trick question) How do you get a / into a filename (i.e., a / that doesn't separate components of the path?
I'be been working with Linux for years, both as end-user and programmer, but I cannot answer this question. There is no way to put slashes in filenames, it's absolutely forbidden by the kernel. You can patch your filesystem via block device access, or use similarly-looking characters from the Unicode, but those aren't solutions.
I understand that Linux ≠ Unix, but the same principle should apply, since the system has to be able to unambiguously extract directory hierarchy from paths.
Does somebody know, what exactly Kernighan and Pike thought about when asking this questions? What was the supposed answer? What exactly is the 'trick'? Or maybe original Unix system simply allowed to escape this slash somehow?
UPD:
I contacted Brian Kernighan about the question and that's what he replied:
The answer is (or was) “You can't.”
Hence, Timothy Martin was right and gets the green tick.
Best Answer
Perhaps the answer is the same as part of the answer in this trick question:
How do you get down off an elephant? You don't. You get it from a goose.
From "The Practice of Programming" by Brian W. Kernighan and Rob Pike, Ch. 6, pg. 158: