This is the mail archive of the cygwin@sourceware.cygnus.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: mysterious bash problem


Well hopefully this will get to the list before umpteen other people have
answered, my mail seems to take forever to turn up on this list :-(

At 06:25 AM 1/13/98 PST, Earnie Boyd wrote:
>>Let foo be a valid shell script (starting with a ":" in the first line, 
>BTW):
>
>To execute a script the first non-blank line must begin with
>#! /bin/sh
>where /bin/sh is the path and shell you want to execute.

That's not completely true.

Whilst putting the #!... as the first line of the script is a good thing,
it's not a requirement. All it does is say, "don't respawn the current
shell to run this script, but spawn this one instead."  If it's not there
then the current shell is used.

If the current shell is used then having a : as the first line is OK since
it's a valid bourne shell command (it evaluates to true among other things
IIRC).  I also remember that this was a standard trick before the #! idea
caught on since it was a harmless way to write scripts that would fail
under csh but run under sh.  So it is valid, but a little old.

Guy


-- 
Guy Gascoigne - Piggford (ggp@informix.com)
Software Engineer, Informix Software, Inc. (Portland, Oregon)

-
For help on using this list (especially unsubscribing), send a message to
"gnu-win32-request@cygnus.com" with one line of text: "help".


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]