1

As far as I understand, to make kernel execve a non-ELF file, the file must be a script started with a she-bang #!, but I have a script run successfully without it, why does this happen?

xtricman⚓ArchVirtual⏺️~ls a.sh -l
-r-xr-xr-x 1 xtricman users 23 9月  26 18:45 a.sh
xtricman⚓ArchVirtual⏺️~cat a.sh
echo "FDHDSFHGFKJJHGO"
xtricman⚓ArchVirtual⏺️~./a.sh
FDHDSFHGFKJJHGO

This a.sh script doesn't contain a she-bang, so how does it run?

Jeff Schaller
  • 67,283
  • 35
  • 116
  • 255

1 Answers1

4

If the file does not start with a "shebang" line, most shells will attempt to execute the lines in the file themselves.

DopeGhoti
  • 76,081