Unix didn't use to support '#!', a brief history
utcc.utoronto.ca
utcc.utoronto.ca
The single executable file generated by the Cosmopolitan linker creates an insane polyglot binary executable that runs on 6 operating systems as well as on bare metal (i.e. bootable as its own OS); in addition, it's a valid Zip archive, and you can modify files inside it using any zip utility... fascinating stuff. On Linux, it bootstraps execution initially as a shell script, but the shell script writes the "ELF" file header and executes it (I'm probably doing a horrible job of explaining though).
If you're interested in learning more, this talk from 2021 is fascinating: https://www.youtube.com/watch?v=1ZTRb-2DZGs. It covers Redbean, a portable, run-anywhere web server built with the APE toolchain; since then Redbean 2 has been released, which adds a lot more features. Here's a link to Redbean: https://redbean.dev/
REM=;echo hello from sh;exit#
echo hello from cmdThis was because sometimes, the kernel would fail to execute a binary for some reason (this was the core bug), returning ENOEXEC to the libc, which, dutifully, would pass it on to the shell as documented in the article. Of course since the failed executable was a real binary, not a script, the shell would fail with the above error.
I haven't encountered the bug in a couple years, so I guess they finally fixed it. Silently.
But hey, don’t let me get in the way of some ignorant Windows-bashing.
"#" => "hash" (never had I heard it being called "pound")
"!" => "exclamation mark/point" (never had I heard it being called "bang")
So to me "#!" was "hash exclamation" in my college in home-country.
Then I went to USA for an exchange program, where people consistently called it "she bang" and "pound bang". Took me a while to get it.
DuckDuckGo also calls exclamation points bangs https://duckduckgo.com/bang
Notably I seem to recall I first encountered it as the symbol found on the forehead of Barry Trotter, a parody Harry Potter published in 2001.
Used in Unix-y circles since at least the 1980s, where "bang paths" were used for UUCP routing:
Octothorpe has never been its “proper” name in any country; just a jocular nickname originating in the US telco industry, which spread from there to computing.
Octothope was coined by Bell Labs. It is certainly not jocular (what?). In point of fact, it is that symbol's proper name and how it is referred to in all Bell manuals and documentation, and this word coinage is little to no different to how the British began using # for pound to distinguish it from £, the currency.
Even though "hash," by hundreds of years, predates all other names for the symbol (originally, "hatch," marks one would make with a hatchet), hashing, the mathematical practice since the 1940's of transformation of a string of characters into a usually shorter fixed-length value or key that represents the original string, was not married in identity or meaning or abbreviation to the # symbol by convention until probably 1990, regardless of location on the planet or country not in North America. No one anywhere in the universe was using the hash symbol in, say, 1975, to refer to the mathematical hashing in computer science. In 1975, the # was the octothrope properly and most commonly (even if no one used that term, they all had a telephone and they still do, and every telephone today still has an octothorpe button, i.e. not a hash button), or the number sign or the pound sign by popularity.
# was never used as an abbreviation for mathematical hashing, again, until maybe late 1980's, probably like about 1991 # became conventionally used by programmers, computer scientists and mathematicians to mean mathematical hash. And even today, every county in the world that has telephones properly has an octothorpe key, not a hash or pound key. Bell coined the term and established it's usage long, long before # was used for math hashes, and even to this day, the octothorpe symbol is likely more common than the hash symbol, just because there are so many damn phones.
taking just that part of the sentence out of context, that almost reads like some historical tome or some fantasy novel. or maybe it's that i lived a good chunk of the middle of last century and this kind of thing makes realize i've been doing this a lot longer than i'd like to admit
So even under that original meaning it fits.
> Perhaps an alteration of shebeen (q.v.), but shebang in the sense "tavern," a seemingly necessary transitional sense, is not attested before 1878 and shebeen seems to have been not much used in the U.S. Bartlett's 1877 edition describes it as "A strange word that had its origin during the late civil war. It is applied alike to a room, a shop, or a hut, a tent, a cabin; an engine house."
> Phrase the whole shebang first recorded 1869, but relation to the earlier use of the word is obscure. Either or both senses also might be mangled pronunciations of French char-à-banc, a bus-like wagon with many seats.
#!/usr/bin/env
echo This might not do what you thought.Similarly, you can have your shell in the GECOS field be null, and again, you'll get the default shell. I think I had a bug report in with Sun complaining that XDM or the fancy XDM replacement didn't work correctly with a null shell value. Or maybe it didn't work if you had the character "ctl-l" as your password.
It's been a while. In any case, don't do these things.
when I learned unix around 1980, you had to start a shell script file with a single # on a line by itself, and there was no bang option... but I want to say there was a way to select sh vs csh, though I can't recall it... maybe you had to start with a couple lines of Bourneshell, and that part would relauch csh on the same file. can't remember though. A dozen years later that was a common technique to launch perl scripts tho I don't recall why.
I mean, it's basically what the article says. Anything that's not an executable and doesn't start with "#!" gets passed to the default shell. ":" is no exception here.
Indeed it does -- try logging in to your Linux machine with your username in all-caps :-)
Old as it is, I'm sure these are still around in some production environments.
I think the designers of Unix were (in part) reacting to some systems they'd experienced (such as IBM mainframes) which had very rich–yet complex, cumbersome and rigid–file metadata, and in reaction decided to make file metadata as simple as possible. The idea that you could support richness with simplicity (extended attributes as arbitrary name-value pairs, leaving the name and value format mostly up to applications) didn't seem to emerge until much later. I could be wrong about this, but I think contemporary Unix-like systems actually borrowed the idea from OS/2 (which in turn was possibly somewhat influenced by classic Mac OS resource forks)
Aren't verbs after "did/didn't" always supposed to be in the present tense? For example you would say "I didn't see you last night" rather than "I didn't saw you last night". Is there a grammatical rule I'm missing?
[1] the other one was this video by youtuber Vsauce, https://www.youtube.com/watch?v=vjqt8T3tJIE
EDIT: wow so many interesting responses, thank you!
This article says that in American English it’s considered an error, but it’s accepted in British English
I think that “used to” is the form seen so often that “use to” just looks and sounds weird to me. I would never use it
I like this last part of one of the answers in particular:
> One of the strongest arguments against treating used to as a standard verb form is the pronunciation. According to the Cambridge Dictionary, with the verb form of use, the s is voiced /juːz/ whereas in the noun form it is not voiced /juːs/. In I used to and I didn't used to, the s is unvoiced. It's definitely not a noun, but it is also not a standard verb form: it is something unique, and that's what upsets the grammarians.
Aside, like sibling comment, I'm also a native American English speaker and it's always been "didn't used to".
[0] https://ell.stackexchange.com/questions/100674/didnt-use-to-...
Including the "didn't" in the search shows that it's still close though: https://trends.google.com/trends/explore?date=all&geo=US&q=d...
https://www.merriam-webster.com/words-at-play/is-it-used-to-...
---
That's the opposite of what your source says:
> In writing, however, use to in place of used to is an error.
Used to X was the standard past tense of to use in the sense of being in the habit of:
I used to fish: I was previously in the habit of fishing, correct both in the past and today.
I use to fish: I am presently in the habit of fishing, correct in the past but no longer understood today.
The second, however, is according to MW occasionally misused to mean "I was previously in the habit of fishing".
> The problem becomes a little trickier in constructions with did. The form considered correct following did, at least in American English, is use to. Just as we say "Did he want to?" instead of "Did he wanted to?," so we say "Did he use to?" instead of "Did he used to?" Here again, only in writing does the difference become an issue.
> While in American English "did used to" is considered an error...
Personally, didn't used to looks jarring, but it made me open the article so…
There’s long been open debate among linguists about what might be formally more correct, but with sound arguments on both sides. It mostly comes down to grammatical rule vs idiomatic phrase with a strong validating history.
That said, he suggests never used to as a way to escape the grammar debate while still keeping used.
”Unix never used to support shebang” almost makes it seem like it just happened.