Executable shell scripts should always start with a shebang line
(#!/path/to/shell) specifying which interpreter to use for the script. This
ensures, for example, that in Debian/Ubuntu environments, scripts that
expect Bash semantics are actually using Bash rather than /bin/sh.
Scripts that are missing a shebang line will also fail to execute when
executed directly (rather than via a shell):
>>> import os
>>> os.execve('./test.sh', ['test.sh'], {})
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
OSError: [Errno 8] Exec format error: './test.sh'
Executable shell scripts should always start with a shebang line (#!/path/to/shell) specifying which interpreter to use for the script. This ensures, for example, that in Debian/Ubuntu environments, scripts that expect Bash semantics are actually using Bash rather than
/bin/sh
.Scripts that are missing a shebang line will also fail to execute when executed directly (rather than via a shell):