[moon] home
IPv4

Erlkönig: Dennis Ritchie and Hash-Bang

An emaial from Dennis Ritchie about #!
parent
[parent webpage]

server
[webserver base]

search
[search erlkonig webpages]

trust
[import certificates]


homes
[talisman]
[zoion]

When I asked Dennis about what he might have called his new feature of #! /bin/sh and similar lines at the beginning of scripts, he answered (don't try to copy/paste my email, it's unicode-obfuscated):

From: "Ritchie, Dennis M (Dennis)** CTR **" <dmr@research.bell-labs.com> To: <erlĸonigⓐtαlismαn.org> Date: Thu, 19 Nov 2009 18:37:37 -0600 Subject: RE: What do -you- call your #!<something> line? I can't recall that we ever gave it a proper name. It was pretty late that it went in--I think that I got the idea from someone at one of the UCB conferences on Berkeley Unix; I may have been one of the first to actually install it, but it was an idea that I got from elsewhere. As for the name: probably something descriptive like "hash-bang" though this has a specifically British flavor, but in any event I don't recall particularly using a pet name for the construction. Regards, Dennis

This was a followup to my discovering his ancient email in an archive somewhere (not to me) about #! and shell scripts:

From uucp Thu Jan 10 01:37:58 1980 >From dmr Thu Jan 10 04:25:49 1980 remote from research The system has been changed so that if a file being executed begins with the magic characters #! , the rest of the line is understood to be the name of an interpreter for the executed file. Previously (and in fact still) the shell did much of this job; it automatically executed itself on a text file with executable mode when the text file's name was typed as a command. Putting the facility into the system gives the following benefits. 1) It makes shell scripts more like real executable files, because they can be the subject of 'exec.' 2) If you do a 'ps' while such a command is running, its real name appears instead of 'sh'. Likewise, accounting is done on the basis of the real name. 3) Shell scripts can be set-user-ID. 4) It is simpler to have alternate shells available; e.g. if you like the Berkeley csh there is no question about which shell is to interpret a file. 5) It will allow other interpreters to fit in more smoothly. To take advantage of this wonderful opportunity, put #! /bin/sh at the left margin of the first line of your shell scripts. Blanks after ! are OK. Use a complete pathname (no search is done). At the moment the whole line is restricted to 16 characters but this limit will be raised.

It's interesting to see the space in #! /bin/sh in the original documentation. It's optional (as noted at the time), and many script authors deliberately leave it out in order to gain that one extra character to use for the interpreter path.

It's also very sad to know that Dennis died (according to Wikipedia) October 12, 2011 (about two years after my email exchange with him) at the age of 70. He and his peers built (and in some cases are still building) tools upon which the world has been changed, and have generally seemed to be really nice guys on top of it. He departure is a loss to a vast number of us that are still here.

encrypt lang [de jp fr] diff backlinks (sec) validate printable
Cogito ergo spud (I think therefore I yam).
[ Your browser's CSS support is broken. Upgrade! ]
alexsiodhe, christopher north-keys, christopher alex north-keys