In addition to its use as a path separator in DOS and Windows, the backslash character itself is also interesting because it is very likely a modern invention, with the first attestation in 1940s (!). Its original use in ASCII (1960s) was for ALGOL operator digraphs `\/` and `/\`. Its early use as the C escape sequence (1970s, replacing `*` in BCPL) suggests that it carried no significant semantics at that time.
C also has trigraphs, in case your keyboard does not have a \ you can type ??/ instead. https://en.wikibooks.org/wiki/C_Programming/C_trigraph
Why is the DOS path character "\"? (2005)
151–160 of 166 posts
Re: Why is the DOS path character "\"? (2005)
#152Earlier quoted context omitted.
Another viewpoint: the problem is caused by Unix allowing any character in filenames (other than slash and null). Other platforms are more restrictive in what characters filenames are allowed to contain. If you banned the '-' character from starting a filename, the problem wouldn't happen. I personally think Unix allowing almost any character in filenames was a mistake. You can put newlines and other control characte…
> the problem is caused by Unix allowing any character in filenames (other than slash and null). Most Unixes don't allow any character; they allow any byte other than ascii slash or zero. Turning bytes into characters is outside the scope of most Unix kernels and the filesystems therein.
All the major contemporary Unix(-like) kernels do have code in them to do file path charset translation. It is very important when dealing with removable media (ISO-9660, UDF), FAT filesystems, network filesystems (especially CIFS/SMB, but even some NFS implementations), filesystems defined in terms of Unicode such as NTFS, HFS+, APFS.
Traditional Unix filesystems don't do this, but they were originally designed at a time when few clearly distinguished the concept of byte from the concept of character.
Re: Why is the DOS path character "\"? (2005)
#153Earlier quoted context omitted.
I never understood why Unix chose "-" for options. It creates unnecessary confusion. E.g. when deleting a directory called "-rf"
Another viewpoint: the problem is caused by Unix allowing any character in filenames (other than slash and null). Other platforms are more restrictive in what characters filenames are allowed to contain. If you banned the '-' character from starting a filename, the problem wouldn't happen. I personally think Unix allowing almost any character in filenames was a mistake. You can put newlines and other control characte…
Shell scripting would be so much more sane (and safe) if filenames couldn't contain spaces (or control chars) and couldn't begin with a '-' character. Then the shell's default $IFS would work as intended in the presence of pathname expansion, and there would be no need to use '--' to delineate the filename arguments from the option arguments when executing commands.
Re: Why is the DOS path character "\"? (2005)
#154Post is still up here: https://docs.microsoft.com/en-us/archive/blogs/larryosterman...
and anyways, (2005).... here's plenty of other discussion from one of the previous posts:
Re: Why is the DOS path character "\"? (2005)
#155Earlier quoted context omitted.
Except C:/ is not a command option, and only Unix people would write "/"
Sounds a bit provincial. That might have been true before mainstream internet access, but the average user these days is likely more familiar with unix style paths via URLs than local filesystem paths. Also, most non-unix operating systems that don't happen to be made by Microsoft also use the forward slashes for paths.
The average user ignores the contents of the address bar. "That's all tech gobbledegook". Increasingly, browsers even hide its contents from the user, just displaying the domain name, making the average user even less aware of it.
> Also, most non-unix operating systems that don't happen to be made by Microsoft also use the forward slashes for paths.
What are "non-unix operating systems that don't happen to be made by Microsoft". Non-Microsoft operating systems in common use – Linux (including Android), macOS/iOS/Darwin/XNU, *BSD – are Unix-like, and hence I wouldn't really call them "non-unix" (even if they are not strictly speaking certified as such)
If we look at non-Microsoft non-Unix(-like) operating systems (none of which are commonly encountered nowadays), we see a lot which use neither forward nor backslashes for directories. For example, OpenVMS and RISC OS both use dots, classic MacOS used colons. Stratus VOS uses the greater-than sign, which it inherited from Multics. The IBM mainframe operating system MVS (nowadays called z/OS) uses dots to separate the components of a dataset name – although those components aren't exactly directories. (It also supports forward slashes in its Unix compatibility subsystem, but that wasn't around for the first 25 years of its existence.)
Re: Why is the DOS path character "\"? (2005)
#156During the time DOS 2.0 was in development, I visited Microsoft with a group of colleagues. (We were touring computer manufactures both in Seattle and in Silicon Valley (where we visited Digital Research, Intel and many others—in those days it was comparatively easy to visit these enterprises for a tour.) We were at Microsoft quite some hours (and we seemed important enough to be fed lunch which consisted of very goo…
> If Microsoft had fixed the problem back then, then there would have been pressure for other operating system developers to also fix the problem. I don't know about all of the other reserved characters, but the colon is the path-separator character in classic Macintosh APIs and I doubt they would have ever been able to "fix" that. > To say ≈255 characters for a filename is long enough is just not being realistic the…
Re: Why is the DOS path character "\"? (2005)
#157Do you correct people when they say “back slash” when reading out a url? When it’s actually a forward slash? Is there a name for this phenomenon? Everyone knows it’s a slash except when its used for something computery. Then it somehow becomes a backslash.
I don't have an answer but it's exactly the same phenomenon as when people refer to '#' as a hash-tag.
Re: Why is the DOS path character "\"? (2005)
#158Earlier quoted context omitted.
I don't have an answer but it's exactly the same phenomenon as when people refer to '#' as a hash-tag.
That's not the same at all. Hash-tag is just a name for that symbol. It's not the original name, but it is a name. "/" is slash! "\" is a backslash! People who do not type windows paths have probably never actually encountered a backslash in their entire lives, but when they see a url they think that the symbol they see all the time in other contexts (/) suddenly has a different name!
Or are you saying 'hash-tag' is the name because although it's a mistake it's used so much now it's considered language?
Language isn't one big blob, even though among many people it could now be considered an alternative pronunciation, and eventually it could be adopted even in places where people would otherwise know better, right now among people in tech and certainly on this site 'hash-tag' to mean the character is incorrect and confusing.
Re: Why is the DOS path character "\"? (2005)
#159Earlier quoted context omitted.
Exactly. Everyone knows it's an octothorp.
Just don't call it "pound" when standing in Britain. :)
It's believed the 'pound' in pound sterling came from a pound of silver or silver coins in weight originally as well.
Re: Why is the DOS path character "\"? (2005)
#160Earlier quoted context omitted.
That will usually work in the US, but Shift-3 returns £ on keyboards configured for the UK!
Is that related in any way to the fact that both symbols can be referred to as a 'pound' symbol, or is it a complete coincidence?