(Sorry for bringing this up after two years, but indeed some shebang/binfmt support can be convenient.)
On 1/3/2014 14:38, sri...@marirs.net.in wrote: > If bash script is run like "./script_name" only bash is understands and > starts interpreting it as a script. #! (shebang/hashbang) is a magic number handled and understood by the kernel, not the shell. > other-wise the filesystem see's it as a collection of ASCII text. > > $ file x > x: ASCII text file guesses the filetype from the name and the contents, while the filesystem doesn't do anything like that at all. > =============== > if (lte->elf == NULL || elf_kind(lte->elf) != > ELF_K_ELF) /* is true*/ > error(EXIT_FAILURE, 0, "Can't open ELF file \"%s\"", filename); > =============== > But if the program is run like this below, it works fine. > > $ ltrace -f -o /dev/null bash x > $ ltrace -f -o /dev/null sh x That's the convenience part. Parsing shebangs (and even all the binfmts) gives executable format transparency just like these provided by the kernel. > Guess this is a wrong bug report filed Kind of, should have been a feature request, or some documentation problem. > M still a student, mistakes are possible in whatever mentioned above. > Will learn from them, and Hope this helps. :) -- Regards, Arthur2e5