-In linux executable file is executed by kernel and format of executable is determinated using either magic numbers or file extension. Built-in module _binfmt_ is responsible for this process. In linux 5.9 you can find <a href="https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/tree/fs?h=linux-5.9.y" target="_blank">seven</a> file formats that kernel supports out of box (take a look onto files with prefix `binfmt` there in the list). And, surprisingly, one of the format is shebang scripts — scripts, that start with `#!` symbol combination. Thus, if you run, using your favorite shell program, script, which has permission to be executed, kernel will decide what to do with your script.
0 commit comments