11 ms·
Unix didn't use to support '#!', a brief history
- hgazx 4y agoOff topic: why isn’t it “didn’t use”?
- ketralnis 4y agoThey're both fairly common https://trends.google.com/trends/explore?date=all&geo=US&q=%22used%20to%22,%22use%20to%22 https://trends.google.com/trends/explore?date=all&geo=US&q=%...
- deleted 4y ago[deleted]
- tjader 4y ago"used to" alone is correct in many situations, "didn't used to" is considered wrong by prescriptivists. 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=didn%27t%20used%20to,didn%27t%20use%20to https://trends.google.com/trends/explore?date=all&geo=US&q=d...
- js2 4y agoIt is. "Didn't /used to/" is a mistake in American English, according to prescriptivists anyway: https://www.merriam-webster.com/words-at-play/is-it-used-to-or-use-to https://www.merriam-webster.com/words-at-play/is-it-used-to-...
- wyattpeak 4y agoEDIT: Never mind, sorry, I missed part of the article, it does indeed say what you say. --- 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".
- as_bntd 4y agoThere's a difference when use is preceded by did: > 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…
- wyattpeak 4y agoOh, excuse me, I entirely missed that section of the page. Makes sense there's a geographical distinction, I'm not American so I suppose I don't have the intuitive issue with it, but on reading I see the logic.
- swatcoder 4y agoGarner’s Modern English Usage (4th edition) acknowledges didn’t used to as “fully accepted” (Stage 5) and notes that it was almost twice as common in journalistic usage. 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.
- eCa 4y agoBut does ”never used to” really mean the same as ”didn’t use to”? ”Unix never used to support shebang” almost makes it seem like it just happened.
- johnday 4y agoYeah, it's different: "Didn't use(d) to [...]" means that there was a time where it did not [...]; whereas "Never used to" means that at every previous time it did not [...].
- lttlrck 4y agoEither seem awkward to me, esp. when written, I'd prefer "didn't always support".
- decremental 4y agoClassic HN. One comment about the article. Nine comments about the title.
- user3939382 4y agoOr nine comments about the scrollbar behavior or design of the content.
- cduzz 4y agoUnix has lots of weird cruft littering its dark corners; for instance you can use : instead of #! and, if I remember correctly, the OS will use "the default shell". 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.
- fsckboy 4y ago> for instance you can use : instead of #! and, if I remember correctly, the OS will use "the default shell" 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.
- iforgotpassword 4y ago> Unix has lots of weird cruft littering its dark corners; for instance you can use : instead of #! and, if I remember correctly, the OS will use "the default shell". 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.
- jjgreen 4y ago> Unix has lots of weird cruft littering its dark corners Indeed it does -- try logging in to your Linux machine with your username in all-caps :-)
- GekkePrutser 4y agoThat does have a specific reason, it's not an arbitrary old thing. It's to support terminals that don't do lowercase. Like some old terminals such as Dec VT05 or TTYs (the ones that printed on paper often didn't support this or they had a mode-switch character for it rather than separate characters) Old as it is, I'm sure these are still around in some production environments.
- divbzero 4y agoThe name for #! must have originated as hashbang which was abbreviated as ’shbang and then later gained an e to become shebang?
- vhasus 4y agoI always thought it was sharp bang = shabang
- jjgreen 4y agoSharp's a different thing, ♯ against #, it always amuses me that Microsoft's version of Java should be called C♯ when their OS has such dreadful support for Unicode that it's almost universally written C#, so C-hash (or C-pound for you left-ponders).
- legalcorrection 4y agoWindows handles Unicode just fine. It’s just not UTF-8. The reason they used # is that it’s on the standard keyboard. But hey, don’t let me get in the way of some ignorant Windows-bashing.
- 2143 4y agoWhere I'm from: "#" => "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.
- dfawcus 4y agoOr even 'hash pling'.
- anttiharju 4y ago> never had I heard it being called "bang" DuckDuckGo also calls exclamation points bangs https://duckduckgo.com/bang https://duckduckgo.com/bang
- HillBates 4y agoUnix didn't used to support VIM
- throw0101a 4y agoThe Prophet Unix needed to come first to make the way ready for the Messiah Vim.
- deleted 4y ago[deleted]
- AceJohnny2 4y agoThis reminds me of a bug in macOS that for a while caused our builds to fail once or twice a month with something like "/bin/sh: /bin/sh: cannot execute binary file" This 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.
- cat_plus_plus 4y agoFor eunuchs it would be... never mind.
- mastazi 4y agoNon native speaker here, it's the second time this week[1] that I see "didn't used to..." instead of what I believe to be the correct form "didn't use to...". 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 https://www.youtube.com/watch?v=vjqt8T3tJIE EDIT: wow so many interesting responses, thank you!
- bowsamic 4y agohttps://www.merriam-webster.com/words-at-play/is-it-used-to-or-use-to https://www.merriam-webster.com/words-at-play/is-it-used-to-... 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
- bobbylarrybobby 4y agoI'm American, and I'd also write "didn't used to". The hard 's' necessitates the 'd', otherwise it'd be pronounced "yooz"
- Izkata 4y agoOver at the English Language Learners [0] Stackexchange, reading through the answers and how they describe their references (I didn't click through to read those references), it seems like "didn't used to" is more acceptable in general for both American and British English, even though it shouldn't be correct because it breaks the rules. 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-get-or-didnt-used-to-get https://ell.stackexchange.com/questions/100674/didnt-use-to-...
- TimTheTinker 4y agoJustine Tunney's APE (actually portable executables) exploits, er, makes use of, the fact that a shebang isn't required to run a shell script. 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). https://justine.lol/ape.html https://justine.lol/ape.html If you're interested in learning more, this talk from 2021 is fascinating: https://www.youtube.com/watch?v=1ZTRb-2DZGs 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/ https://redbean.dev/
- easrng 4y agoIf you want a simpler polyglot, here's a sh/bat to get you started: REM=;echo hello from sh;exit# echo hello from cmd
- jsymolon 4y agoWith all the shabang, shebang, splatping going on ... someone might stumble upon the magic word and turn into Captain Marvel.
- amelius 4y agoWhy isn't this in the file's metadata?
- skissane 4y agoBecause Unix's file metadata was traditionally very simplistic – and while many contemporary Unix-like systems do better–such as with extended attributes (xattrs)–that feature came historically late enough that it has never seen anywhere near as much use as it would have had it been implemented earlier. 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)
- bigbillheck 4y agoRuns contrary to the unix philosophy.
- yencabulator 4y agoMy favorite unix shebang related oddity: #!/usr/bin/env echo This might not do what you thought.