Sunday, December 11, 2022

Urban Legend

When I was talking about Windows 11 and the terminal, I remembered a story from a Urban Legend board on a certain huge message board (it was 2, not 5 lol). There, it was said that the reason why you can't create a folder or file named PRN in Windows was because Bill Gates didn't like this word, or because it was the initials of someone who used to bully him (;-s).
I think anyone who was a Unix and MS-DOS user (Linux did not exist at that time) knows this, but I would like to write it down as a reminder because I think there are not so many engineers from that era anymore.
The following commands, which are commonly used in Unix (again, Linux did not exist yet in the MS-DOS era) scripts,

$ (various commands) > /dev/null
$ (various commands) > /dev/null

This means that the text information output by the command is not shown on the screen. The reason why you need to do is that sometimes the output of scripts became so huge, and you cannot see the critical message, you can omit the unnecessry output. Since MS-DOS mimics Unix a little bit (:-), you can use the same command in MS-DOS

C:\> (some commands) > NUL
C:\> (some commands) > NUL

The difference from Unix is that NUL is a reserved word, not a device.
Next, the following command on Unix,

$ tty
/dev/pts/0
$ echo "Hello World" > /dev/pts/0
$ tty
/dev/pts/0
$ echo "Hello World" > /dev/pts/0

The tty command outputs the name of the screen you are using (the name depending on your environment). The second command outputs text directly to the screen, which is what the second command means. If you have a Linux environment, try to open two terminals and write on each terminal name. It will be a simple chat (:-). Of course, since this is a standard OS device file, the contents of the /dev/pts/* file will not become "Hello World" (lol). The same function works if a printer is connected.
Similarly, in MS-DOS, the reserved word for the connected printer was PRN, so you can use

C:\> type autoexec.bat > PRN
C:\> type autoexec.bat > PRN

would print to the printer. Of course, this was only if there was a printer directly connected to the serial port of the PC. Incidentally, I remember that I used to run this command to check the contents of autoexec.bat, which was launched at the beginning of the OS, when my computer was acting strangely (:-).
I don't think anyone executes such commands nowadays, but I feel a long history in that NUL and PRN have been inherited by the current Windows as reserved words to maintain compatibility of such functions of MS-DOS (:-o).

Labels: , ,

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home