It's not a language feature, it's a kernel feature. You'll need to create a new kernel to do that (or get your code into an existing kernel, good luck).
No, Bash is not a kernel. Bash is a shell, a userspace software.
You'd need to get your code into Linux, Windows, XNU (macOS), or the BSDs.
Bash and other shells ignore shebangs because they start with a #, which, just like Python, denotes a comment.
Only when you ask the kernel to execute a script file, it'll see the #! that shebangs start with, read the path afterwards, then launch the program at that path and pass it the script location as parameter.
110
u/tndaris Nov 06 '20
Correct, that's a https://en.wikipedia.org/wiki/Shebang_(Unix)