Why is the DOS path character "\"?
blogs.msdn.com
blogs.msdn.com
PIP PRN:=FOO.TXT
PIP itself predates CP/M having been present on machines such as the PDP-11. Wikipedia tells me that it was first implemented on the PDP-6. For example, on the PDP-10 you could do: PIP DTA1:/X=DSK:*.*
which copied all the files from the disk onto tape. The /X there modifies the destination and indicates that file attributes (modification time etc.) should be preserved.PS Now my memory is fully restored from 1980s backing store I believe that CP/M actually replaced the / in PIP with single character switches inside [] and that the route to / being switches in MS-DOS most likely comes through DEC heritage from the PDP series. For example, the W switches would ignore r/o set on a file and overwrite it. This would copy all .COM files (i.e. executables) from B: to A: and overwrite without warning:
PIP A:=B:*.COM[W] copy file.txt LPT1
she can also print multiple files or results of print to file using the /b switch (binary) ignoring EOFThat also explains why you shouldn't use LPT1 as file name - it was a special name that meant first parallel port. I remember seeing a ridiculing thread about it on HN some time ago
¥docs¥finance¥
To understand the reason, just check out the table on the Shift-JIS encoding:
http://en.wikipedia.org/wiki/Shift_JIS
Specifically, look at the character at 0x5C where the backslash sits in ASCII. Learning this was one of those mind-blowing moments when you try to imagine what a world where that was normal would be like.
Using ¥ as backslash still works in Windows and legacy apps (in OSX option+¥ gives a "real" \.)
This leads to some interesting situations: Word documents filled with ¥ where there should be \ and vice versa. By interesting I mean extremely annoying.
Another caveat is that anything hardcoded to use the tilde ~ will probably break because it is mapped to a completely key on Japanese keyboards. This causes endless fun in DOSBOX or even newer games: to get the console in Doom 3 I had to edit the source and recompile it with the console key mapped to another character.
Here is some more info: http://www.cs.tut.fi/~jkorpela/chars.html#national-ascii
...
Systems that support ISO Latin 1 in principle may still reflect the use of national variants of ASCII in some details; for example, an ASCII character might get printed or displayed according to some national variant. Thus, even "plain ASCII text" is thereby not always portable from one system or application to another.
That's awesome! Hard to believe that systems have worked as well as they have. It's pretty obvious nobody was expecting that one day all computers would have to read each other's data pretty much constantly.
So I guess the question is: why did the DOS developers pick the character that happens to vary from region to region? I guess they didn't know?
I've wondered about that as well. My guess is that they looked at it and thought 'who needs two kinds of slash anyway?' I would love to know the actual thought behind that choice.
https://blogs.msdn.com/b/michkap/archive/2005/09/17/469941.a...
People use "/" as a date separator as in 12/25/1979 so effectively banning that character as a character in filenames seems a really poor choices. By that metric chosing "\" is a much better choice because "\" is used no where I know outside of computers. I've never encountered it anywhere outside of computers so arguable it's the perfect choice for a path character.
Just a guess, but it's probably because \ is used for character escapes in C (and the Bourne shell). Given that the history of Unix is inextricably tied to C, it kind of makes sense to use / over \ so you don't have to do lots of \\ to escape path names.
_ or | get my vote, but it's a bit late now to fix the mistakes of the past. There are enough special chars needed anyway that collisions are inevitable.
At least they didn't pick 'E'.
Each country has a different layout, are you aware of it?
In most European countries both types of slash require two key presses.
And given that the history of '\' as a path separator is that long, maybe you haven't seen in elsewhere _because_ it is now forever taken for the world's most popular OS?
Those uses rarely have it next to whitespace, and almost never immediately after whitespace.
If someone’s named Jean-Claude, it is not customary to refer to them as -Claude for short, and if I refer to items dated 2012-03-19 and 2012-03-20, it is not customary to call one of them -20.
But that last example shows something that Unixy switches do conflict with: negative numbers.
Two (not entirely serious) counterarguments:
- Lists like this
- Abusing the char as em-dash
- Weird languages. In German it's quite common to use that character to shorten the monster words. Pulling samples from my reared (note the disclaimer about being not to serious)
Lebens- und Krankenversicherung
(Shorthand for Lebensversicherung und Krankenversicherung)
The inverse is possible, but less common as far as I am aware Arbeitsplatz und -Umfeld
(Arbeitsplatz und Arbeitsumfeld?)
Looks ugly to me and the samples are pre-coffee, but this is definitely possible.The last usage is also possible in English. A construction like “face-huggers and -eaters” is rare but not outlandish.
/ is easier to type than \
But hey that is just me.
Back when I was a Windows dev I drove the guys I worked with nuts because I used "/" instead of "\", figuring it would be more portable and I wouldn't have to write "\\" all the time. Of course, C# has @"" just to deal with that latter problem.
Also, if you really want to make portable C# code, you should use Path.DirectorySeparatorChar, as it's not platform specific at all.
http://msdn.microsoft.com/en-us/library/system.io.path.direc...
I've had embarrassing MS-DOS moments in the past where I was typing out something like a recursive-delete on a path. If you accidentally hit RETURN instead of a backslash then you can do things like blow away entire parent directories unintentionally. This didn't exactly improve my already-critical view of PCs. :)
I have never seen a PC keyboard with the backslash anywhere other than in the bottom LEFT corner next to your left smallest/pinky finger with one exception: in Germany and France, they keyboards sometimes have backslash on the top line numerical keys.
I .. switch all my keyboard to the US layout because I feel that I kill my fingers otherwise to reach {[]}| and \
On the other hand, the computers at Bell Labs had an arrow key, which is why R (which is based on S) uses '<-' for assignment, as the two-character combination was enabled for compatibility reasons.
And on a related note, I can't imagine how people use Vim without rebinding ESC to Caps_Lock. Given that ESC used to be where TAB currently is (and the latter is too useful to be removed), I don't really see a point in keeping the obsolescent Caps_Lock, especially when it's so irritating to keep moving the hand to the furthest corner of the keyboard.
I have also dealt with crappy tiny keyboards that don't even have any keys beyond the standard chunk (So no function keys, 10-key, or arrows / browsing control)
My favorite keyboard happens to be the Apple Extended Keyboard II, but I can't use one these days because its caps key would physically toggle between on and off states (like a typewriter caps key) which means it does not make a very good candidate for remapping.
[I didn't use QDOS, but I did use CP/M and it had the most unholy command line syntax. I don't fondly remember PIP...]
After years I still think that the use of forward slash is the worst decision ever. At least Apple chose ":" on Mac OS classic.
Edit: This is for the standard US keyboard. A more general way of thinking about it, though a bit more to remember: associate "positive" with "forward", and see that '/' has a positive slope. Or just go listen to a BBC podcast, and let the sound of the broadcaster saying "bbc dot co dot uk forward-slash newspod" resonate in your head.
"File slash" and "option slash" were far less confusing than decoding the secretary's concept of "forward" and "back."
Perhaps a better way would be to think (for L-to-R language users) of the charater toppling "forwards" / or "backwards" \ WRT the text direction.
English is left-to-right. (And gravity is down.)
Is the slash "leaning forward" or is it "leaning backward".
Upslash / and downslash \ would make more sense, but this is what we have. My mnemonic is that forward and back are the opposite of what makes sense.
- "slash": the character you use in English and when typing fractions; and
- "backslash": the Microsoft-slash: backwards, like everything else they do.
Another way to remember is that (at least on US keyboards) the slash is always in the same place (on the same key as the question mark). The backslash, being the oddity that it is, is in different places, depending on the keyboard vendor.
Argh!
Will continue reading anyway, and will lose karma for this, but shit, does no one even read their shit after publishing anymore?