[CentOS] Real sh? Or other efficient shell for non-interactive scripts
Gordon Messmer
gordon.messmer at gmail.com
Fri Apr 24 19:32:41 UTC 2015
On 04/24/2015 09:59 AM, Steve Lindemann wrote:
>
> A script with no shebang will run in the environment of the account
> running the script.
Bad test on my part, apparently.
$ python
>>> import os
>>> os.execv('/home/gmessmer/test', ('test',))
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
OSError: [Errno 8] Exec format error
So a script with no shebang will fail when the shell calls exec(). If
that's so, then starting the executable script with an interpreter is
probably shell-defined. In other words, each shell might do something
different to run a script that has no shebang. Most probably do default
to trying itself as the interpreter first. Interesting.
More information about the CentOS
mailing list