delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/1997/03/28/15:16:44

From: steve AT icarus DOT icarus DOT com (Stephen Williams)
Subject: Re: bash won't hand off to perl (reprise)
28 Mar 1997 15:16:44 -0800 :
Approved: cygnus DOT gnu-win32 AT cygnus DOT com
Distribution: cygnus
Message-ID: <199703280621.WAA23997.cygnus.gnu-win32@icarus.icarus.com>
Mime-Version: 1.0
X-Mailer: exmh version 1.6.7 05/05/96
Original-To: JP Shipherd <jp AT nuancecom DOT com>, gnu-win32 AT cygnus DOT com
In-reply-to: Your message of "Thu, 20 Mar 1997 12:12:37 PST."
<3 DOT 0 DOT 32 DOT 19970320121233 DOT 00a33a30 AT awesome DOT nuance DOT com>
Original-Sender: owner-gnu-win32 AT cygnus DOT com

jp AT nuancecom DOT com said:
> I posted a while back complaining that bash.exe wouldn't hand off to 
> the right command interpreter even if the shell script started with 
> something like:

#!/usr/local/bin/perl

jp AT nuancecom DOT com said:
> However, the following still does not work: 

%> /bin/sh perl-script.pl

jp AT nuancecom DOT com said:
> In this case bash still tries to process the file as if it is a 
> bourne shell script.

As it should. The '#' character marks a comment for bourne shell, so is
ignored. And anyhow, /bin/sh does not and should not check the magic number
of a file to see if it an a.out or coff or whatever, it accepts a text file.
However, it you try:

	/bin/sh -c ./perl-script.pl

Then you will get what I think you are trying to achieve. Notice the -c switch,
which tells sh to interpret this as a command, and so pass the perl-script.pl
file to exec(2), which is where the magick numbers are examined and the
correct interpreter selected.

'k?

-- 
Steve Williams
steve AT icarus DOT com
steve AT picturel DOT com

"The woods are lovely, dark and deep.  But I have promises to keep,
And lines to code before I sleep, And lines to code before I sleep."


-
For help on using this list, 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