delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/1998/01/17/12:00:19

From: ggp AT informix DOT com (Guy Gascoigne - Piggford)
Subject: Re: mysterious bash problem
17 Jan 1998 12:00:19 -0800 :
Message-ID: <3.0.3.32.19980115095536.00fd5dd0.cygnus.gnu-win32@pop.pdx.informix.com>
References: <19980113142530 DOT 20840 DOT qmail AT hotmail DOT com>
Mime-Version: 1.0
To: "Earnie Boyd" <earnie_boyd AT hotmail DOT com>, Ulrich DOT Lauther AT mchp DOT siemens DOT de
Cc: gnu-win32 AT cygnus DOT com

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 AT informix DOT com)
Software Engineer, Informix Software, Inc. (Portland, Oregon)

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

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019