public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* bash won't hand off to perl (reprise)
@ 1997-03-20 12:14 JP Shipherd
  1997-03-20 20:41 ` Fergus Henderson
  1997-03-28 10:32 ` Stephen Williams
  0 siblings, 2 replies; 5+ messages in thread
From: JP Shipherd @ 1997-03-20 12:14 UTC (permalink / raw)
  To: gnu-win32

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

After applying Geoffrey Noer's patch (well, OK, getting a cygwin.dll from
someone who did - Thanks Ron!) it did work.

However, the following still does not work:

%> /bin/sh perl-script.pl

In this case bash still tries to process the file as if it is a bourne
shell script.  Why would you ever want to do that you ask?  Weeell, believe
it or not I'm trying to run a gnu makefile from a cmd prompt.  It actually
works, kind of.

Has anyone attempted to do/fix this?

Thanks,
--jp

(Gzipped, patched versions of cygwin.dll or bash.exe gladly accepted via
email!)
-
For help on using this list, send a message to
"gnu-win32-request@cygnus.com" with one line of text: "help".

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: bash won't hand off to perl (reprise)
  1997-03-20 12:14 bash won't hand off to perl (reprise) JP Shipherd
@ 1997-03-20 20:41 ` Fergus Henderson
  1997-03-28 10:32 ` Stephen Williams
  1 sibling, 0 replies; 5+ messages in thread
From: Fergus Henderson @ 1997-03-20 20:41 UTC (permalink / raw)
  To: JP Shipherd; +Cc: gnu-win32

JP Shipherd, you wrote:
> 
> However, the following still does not work:
> 
> %> /bin/sh perl-script.pl
> 
> In this case bash still tries to process the file as if it is a bourne
> shell script.

That is what it is supposed to do.

-- 
Fergus Henderson <fjh@cs.mu.oz.au>   |  "I have always known that the pursuit
WWW: < http://www.cs.mu.oz.au/~fjh >   |  of excellence is a lethal habit"
PGP: finger fjh@128.250.37.3         |     -- the last words of T. S. Garp.
-
For help on using this list, send a message to
"gnu-win32-request@cygnus.com" with one line of text: "help".

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: bash won't hand off to perl (reprise)
  1997-03-20 12:14 bash won't hand off to perl (reprise) JP Shipherd
  1997-03-20 20:41 ` Fergus Henderson
@ 1997-03-28 10:32 ` Stephen Williams
  1 sibling, 0 replies; 5+ messages in thread
From: Stephen Williams @ 1997-03-28 10:32 UTC (permalink / raw)
  To: JP Shipherd, gnu-win32

jp@nuancecom.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@nuancecom.com said:
> However, the following still does not work: 

%> /bin/sh perl-script.pl

jp@nuancecom.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@icarus.com
steve@picturel.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@cygnus.com" with one line of text: "help".

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: bash won't hand off to perl (reprise)
  1997-03-21 15:52 JP Shipherd
@ 1997-03-22  0:07 ` Jim Balter
  0 siblings, 0 replies; 5+ messages in thread
From: Jim Balter @ 1997-03-22  0:07 UTC (permalink / raw)
  To: JP Shipherd; +Cc: gnu-win32

JP Shipherd wrote:

> You're right, this is the same behaviour exhibited on solaris.  However
> that is exactly the command spawned by gnumake (if SHELL=/bin/sh).  

What makes you think so?  When make invokes the shell, it invokes it
with the -c flag.  See the shell documentation for the difference
between sh -c foo.pl and sh foo.pl

Note that this thread is not gnu-win32 specific; there are other sources
(e.g., tfm) for getting answers to such questions.

--
<J Q B>
-
For help on using this list, send a message to
"gnu-win32-request@cygnus.com" with one line of text: "help".

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: bash won't hand off to perl (reprise)
@ 1997-03-21 15:52 JP Shipherd
  1997-03-22  0:07 ` Jim Balter
  0 siblings, 1 reply; 5+ messages in thread
From: JP Shipherd @ 1997-03-21 15:52 UTC (permalink / raw)
  To: Rick Rankin; +Cc: gnu-win32

At 09:11 PM 3/20/97 -0700, you wrote:
>>However, the following still does not work:
>>
>>%> /bin/sh perl-script.pl
>>
>>In this case bash still tries to process the file as if it is a bourne
>
>This is not a bug; it is correct behavior. When you execute the command
>
>/bin/sh perl-script.pl
>
>you are telling the shell to interpret the file "perl-script.pl" as a
>bourne shell script. 

You're right, this is the same behaviour exhibited on solaris.  However
that is exactly the command spawned by gnumake (if SHELL=/bin/sh).  How
does it happen differently if executed in a makefile than executed from the
command line?

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~1997-03-28 10:32 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1997-03-20 12:14 bash won't hand off to perl (reprise) JP Shipherd
1997-03-20 20:41 ` Fergus Henderson
1997-03-28 10:32 ` Stephen Williams
1997-03-21 15:52 JP Shipherd
1997-03-22  0:07 ` Jim Balter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).