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.
The loader executes the specified interpreter program, passing to it as an argument the path that was initially used when attempting to run the script, so that the program may use the file as input data.
There are shells other than bash, and a program can directly use the execve(2) syscall on a file with a shebang without having to implement any sort of special parsing.
If you click the loader ( https://en.wikipedia.org/wiki/Loader_(computing) ) link in the quote you posted (without providing a link), you will see that the program loader is the handler for the execve system call, which means it's not something implemented in application code, but rather part of the syscall logic, which most of the time is implemented in the kernel.
235
u/_letMeSpeak_ Nov 06 '20