Shell execution ( [was] Re: Value of $? lost in the beginning of a function.)

Glen Barber glen.j.barber at gmail.com
Mon Jul 20 18:25:10 UTC 2009


On Mon, Jul 20, 2009 at 1:56 PM, Lowell
Gilbert<freebsd-stable-local at be-well.ilk.org> wrote:
> Glen Barber <glen.j.barber at gmail.com> writes:
>>> The shell specified in the "#!" first line is only consulted if you run
>>> it as "./foo.sh".  Otherwise, it's input to the shell that you started,
>>> and the line is only a comment.
>>>
>>
>> I suppose that makes sense, but what if the script location is in the
>> user's $PATH?
>
> That would be the same as "./foo.sh".
> The distinction is between whether the file is treated as an executable
> or as input to a script.  You might find the manual page for execve(2)
> useful for more detail on how the former case is handled.
>
>
>

Aha!  Yes, I will have a look.  Thanks for the point in the right direction.

-- 
Glen Barber


More information about the freebsd-stable mailing list