News for hackers. Stuff that matters.
Re:Demystifying the (Shebang): Kernel Adventures by pkaye on Thursday April 10, 2025 @03:28PM (#43647280)
Yes you can use binfmt_misc to allow arbitrary executable file format to be passed to an interpreter matched either by a filename extension or a magic number at a specific offset within the executable.

https://en.wikipedia.org/wiki/Binfmt_misc

Re:Demystifying the (Shebang): Kernel Adventures by kreetx on Friday April 11, 2025 @03:29AM (#43651343)
Yup, this way you can skip the shebang line for your scripts in some arbitrary language.

I have it set up for Haskell (it's somewhat hackish): there is preconfigured haskell project in a certain location with desired dependencies, imports, etc., so when executing a .hs file this file is copied into that as Main and ran. A similar setup will work for any language.

Edit: `cabal` and `stack` both have script commands now, so these would be an alternative to the above, downside being that every such script would need the shebang intro with dependencies, etc.