The story of two slashes...
Anyone who has used both Windows and *Nix operating system only can relate to this post. Specifically, those who dual-boot.
First thing you would notice when you are using *Nix after Windows is how the file location or path is described/shown. The effect is much more pronouned because unlike Windows, which is a GUI based OS, almost everything is done via using commands at the terminal.
So as you switch from Win to *Nix, inadvertently you type the file locations using backward-slash - "\" and then find the error on the console. Then you go and correct the mistake by using forward-slash "/".
So while in Windows the path would be - C:\Users\Abhishek\Downloads\modi.jpg
In *Nix it would be /home/abhishek/Downloads/modi.jpg
Everytime I used to wonder that why this is so, but because I was in the midst of things, doing something, I would just cajole mylsef in believing that it must be just a convention and nothing more, and then would move on with the task.
Today, when this happened again, I decided to drop everything I was doing and search for the reason.
Since the DOS programmers came from *Nix background and it was itself written in C, so it could not be true that just for the sake of convention they used backward-slash in Windows, against forward-slash. There is no reason to do that, as most of the in-convenience was going to be the programmers themselves, who came from *Nix.
And the reason in a layman's language is -:
DOS1.0 only supported floppy disks. It did not support any directories, there were just files in a single root directory. So when utilities were written for DOS and programmers (mostly at IBM) started using "/" as the switch character (A switch is a parameter which modifies a command. Like dir /w. In *Nix "-" is used as the switch), which conflicted with the path character of a another relatively popular operating system, nobody bothered because it was not relevant. After all, since there were no directories, there was no path and hence no use of the path separators.
Then came DOS2.0 with a 10 MB Hard Disk(how generous) and then the requirement came of the path separators, along with the directories. But then like *nix form of path separator "/" cannot be used because it was already used as a switch character since DOS1.0 days.
So what can be done, the path separator then became the backward-slash on DOS "\" as it was visually similar to the forward-slash.
But obviously programmers were not happy with the change and they made changes to the OS so that "/" could be used as the path separators, and some other stuff too, which could be a bit technical for this post.
So this is the story of the two slashes.
After getting this stuff out of my mind, I do not think next time I am going to make mistake again with the path separators either on Win or *Nix. The stuff is now clear.
a) Now as you would have seen in the post, the path in Windows carries the drive letter, where the file is stored, while in *Nix, it is not there? Why? This is the next question which would be haunting me for some time, until I have the answer.
b) Last week, I wrote only one post and almost managed to wash out the week. Things were tough and they are not any better this week either, but I would try to achieve the weekly goal. I had the option to move the last week's solitary post to this week, as the week was already lost and I could have started this week at least on a better note, but then I decided against doing it. It would be like cheating my own self. I am not doing this for anything else, rather than to improve my skill set, and cheating would not let me improve upon my goal.
Anyways, any kind of cheating in anything else, does not take one too far. Ultimately, the race is long and in the end it is only with yourself. So what you would do by cheating?
c) I have not been too active on this blog in the past and I intend to change the status quo.