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

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



On Fri, Apr 24, 2015 at 12:04 PM, John R Pierce <pierce@xxxxxxxxxxxx> wrote:
> On 4/24/2015 9:47 AM, Gordon Messmer wrote:
>>
>> On 04/24/2015 03:57 AM, Pete Geenhuizen wrote:
>>>
>>> if you leave it out the script will run in whatever environment it
>>> currently is in.
>>
>>
>> I'm reasonably certain that a script with no shebang will run with
>> /bin/sh.  I interpret your statement to mean that if a user is using ksh and
>> enters the path to such a script, it would also run in ksh.  That would only
>> be true if you "sourced" the script from your shell.
>
>
> oh fun, just did some tests (using c6.latest).   if you're in bash, ./script
> (sans shebang) runs it in bash.  if you're in dash or csh, ./script runs it
> in sh.    if you're in ksh, it runs it in ksh.
>

If I'm doing cron jobs or a top-level control script I usually just
specify the interpreter explicitly like
 cd somewhere && sh some_script.sh
 cd somewhere_else && perl some_script.pl
so it works even if I forget to chmod it executable...

-- 
   Les Mikesell
     lesmikesell@xxxxxxxxx
_______________________________________________
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