[CentOS] Real sh? Or other efficient shell for non-interactive scripts
John R Pierce
pierce at hogranch.com
Fri Apr 24 19:47:50 UTC 2015
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
More information about the CentOS
mailing list