Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com Date: Wed, 6 Oct 2004 09:48:56 +1000 (EST) From: luke DOT kendall AT cisra DOT canon DOT com DOT au Subject: Re: Shell script ignores $PATH?! To: cygwin AT cygwin DOT com In-Reply-To: <41628485.1BC86580@dessent.net> MIME-Version: 1.0 Content-Type: TEXT/plain; CHARSET=US-ASCII Message-Id: <20041005234856.9AEE684C3C@pessard.research.canon.com.au> 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[0] != '#' || buf[1] != '!') > { > pgm = (char *) "/bin/sh"; > arg1 = NULL; > } Thanks, Brian. It'd be nicer if it instead looked for sh in PATH, but the above is perfectly reasonable. I think it's entirely fair that the behaviour is system dependent: I agree that what I was doing was too ambiguous. Now that I know the cause, I can cope. 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. The number of times I've changed "#!/usr/local/bin/perl" to "#!/opt/bin/perl" or "#!/usr/bin/perl" and back again, and for other interpreters, is quite large. Seems like an obvious long-standing missing Unix feature. (Apologies for the off-topic rant.) luke -- 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/