This is the mail archive of the
mailing list for the Cygwin project.
Re: Shell script ignores $PATH?!
- From: Brian Dessent <brian at dessent dot net>
- To: cygwin at cygwin dot com
- Date: Tue, 05 Oct 2004 04:24:53 -0700
- Subject: Re: Shell script ignores $PATH?!
- Organization: My own little world...
- References: <20041005075118.2D61385135@pessard.research.canon.com.au>
- Reply-to: cygwin at cygwin dot com
> 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 != '#' || buf != '!')
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.
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Problem reports: http://cygwin.com/problems.html