Today, 42 years ago, on the 10th of January, Dennis Ritchie – the co-creator of C and Unix – wrote the following:
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. ~~~ ~~~ ~~~ ~~~ ~~~ ~~~ ~~~ ~~~ To take advantage of this wonderful opportunity, put #! /bin/sh at the left margin of the first line of your shell scripts.
Wikipedia has an article about the shebang and mentions the following: “Dennis Ritchie (DMR) introduced kernel support for interpreter directives in January 1980”. Maybe “interpreter directive” sounds cool, but you can’t deny that “shebang” has more sex appeal.
A shebang is a special directive in a script or program. It’s the first line of code and tells the shell which interpreter to use for execution.
In other words, it instructs the system as follows: “run this script with this specific application.” It depends on the script and the programming language which application to use — the Python interpreter for Python scripts, the Bash command for Bash scripts, and so on.
Most of us will know the
# character as the hashtag. But it’s also called a pound sign when combined with numbers. Or the sharp when used in musical notation (or in the
C# programming language). However, less known is that a
bang is another word for the exclamation mark. Let’s put these two together, and the shebang is born.
<Fred>🙋🏼♂️: Just a thought: Shellbang, as in, execute with the following shell?
Today we also celebrate another birthday. The birth of Kaboom Shebang, the blog of Kaboom, named after Kaboom’s mascot: the shebang. In the first publication, we’ll set a challenge for this blog. Read more about that challenge in the /born-by-smart-contract article.
So in the style of that program we programmers wrote at least once, but perhaps many times: