This is the mail archive of the
mailing list for the Cygwin project.
Re: Shell script ignores $PATH?!
On Wed, Oct 06, 2004 at 09:48:56AM +1000, email@example.com wrote:
>On 5 Oct, Brian Dessent wrote:
>>If you want to specify what shell is used to run a script you either
>>need to specify it in the shebang of the script (#!/path/to/shell) or
>>you need to start that shell explicitly (/path/to/shell
>>/path/to/script). If you try to execute a script with no shebang then
>>the behavoir is going to be system-dependent. On cygwin that means
>>defaulting to /bin/sh, as you can see from spawn.cc:spawn_guts()
>> if (buf != '#' || buf != '!')
>> pgm = (char *) "/bin/sh";
>> arg1 = NULL;
>It'd be nicer if it instead looked for sh in PATH,
Nicer for you. Not so nice for someone who has a sh.exe in their path
which is not cygwin-aware or is not actually a shell at all.
>BTW, I've wondered for many years why the #! notation doesn't allow a
>pathless program name, to mean "look it up in PATH" in the normal way.
It's a standard idiom.
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Problem reports: http://cygwin.com/problems.html