| www.delorie.com/archives/browse.cgi | search |
| Mailing-List: | contact cygwin-help AT cygwin DOT com; run by ezmlm |
| List-Subscribe: | <mailto:cygwin-subscribe AT cygwin DOT com> |
| List-Archive: | <http://sourceware.org/ml/cygwin/> |
| List-Post: | <mailto:cygwin AT cygwin DOT com> |
| List-Help: | <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs> |
| Sender: | cygwin-owner AT cygwin DOT com |
| Mail-Followup-To: | cygwin AT cygwin DOT com |
| Delivered-To: | mailing list cygwin AT cygwin DOT com |
| Message-ID: | <41628485.1BC86580@dessent.net> |
| Date: | Tue, 05 Oct 2004 04:24:53 -0700 |
| From: | Brian Dessent <brian AT dessent DOT net> |
| Organization: | My own little world... |
| MIME-Version: | 1.0 |
| To: | cygwin AT cygwin DOT com |
| Subject: | Re: Shell script ignores $PATH?! |
| References: | <20041005075118 DOT 2D61385135 AT pessard DOT research DOT canon DOT com DOT au> |
| X-IsSubscribed: | yes |
| Reply-To: | cygwin AT cygwin DOT com |
luke DOT kendall AT cisra DOT canon DOT com DOT 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/
| webmaster | delorie software privacy |
| Copyright © 2019 by DJ Delorie | Updated Jul 2019 |