Shell script ignores $PATH?!
Brian Dessent
brian@dessent.net
Tue Oct 5 11:23:00 GMT 2004
luke.kendall@cisra.canon.com.au wrote:
> So my guess is that when a script with no #!/path line is run, then the
> default is to run /usr/bin/sh to start it, and the PATH simply doesn't
> come into it.
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[0] != '#' || buf[1] != '!')
{
pgm = (char *) "/bin/sh";
arg1 = NULL;
}
In other words, you were being too ambiguous. Explicitly call the shell
that you want if it differs from the norm. The "it'll use whatever is
in the path" is a DOS-ism.
Brian
--
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Problem reports: http://cygwin.com/problems.html
Documentation: http://cygwin.com/docs.html
FAQ: http://cygwin.com/faq/
More information about the Cygwin
mailing list