Subject: Re: mysterious bash problem
From: [email-masked] (Guy Gascoigne - Piggford)

17 Jan 1998 12:00:19 -0800
Message-ID: <[email-masked]>
References: <[email-masked]>
Mime-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
To: "Earnie Boyd" <[email-masked]>, [email-masked]
Cc: [email-masked]

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 ([email-masked])
Software Engineer, Informix Software, Inc. (Portland, Oregon)

-
For help on using this list (especially unsubscribing), send a message to
"[email-masked]" with one line of text: "help".