Re: Real sh? Or other efficient shell for non-interactive scripts

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



On 4/24/2015 12:32 PM, Gordon Messmer wrote:
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.

is file test chmod +x  ?

--
john r pierce, recycling bits in santa cruz

_______________________________________________
CentOS mailing list
CentOS@xxxxxxxxxx
http://lists.centos.org/mailman/listinfo/centos




[Index of Archives]     [CentOS]     [CentOS Announce]     [CentOS Development]     [CentOS ARM Devel]     [CentOS Docs]     [CentOS Virtualization]     [Carrier Grade Linux]     [Linux Media]     [Asterisk]     [DCCP]     [Netdev]     [Xorg]     [Linux USB]
  Powered by Linux