[comp.lang.perl] Force script to use /bin/sh?

tneff@bfmny0.UU.NET (Tom Neff) (02/17/90)

OK all you Perl gurus and hackers out there.  I need a trick statement
that does the REVERSE of the 'nih' front end:

	eval "exec /usr/bin/perl -S $0 $*"
		if $running_under_some_shell;

This forces Perl, sh and Csh to feed the script to Perl.  I need something
to force Perl, sh and Csh to feed the script to sh!

I have thought about it some, but it's hard to think of a syntax that
fools sh and Perl like the above.

------------------------------------------------------------------------

I might add in passing that Perl ought to respect the #! notation itself,
and pass scripts to the chosen interpreter (if it doesn't end in 'perl').

*** THIS WOULD MAKE A NICE THING TO ADD IN PATCH 9 LARRY ***

hee hee

------------------------------------------------------------------------

lwall@jpl-devvax.JPL.NASA.GOV (Larry Wall) (02/18/90)

In article <15178@bfmny0.UU.NET> tneff@bfmny0.UU.NET (Tom Neff) writes:
: I might add in passing that Perl ought to respect the #! notation itself,
: and pass scripts to the chosen interpreter (if it doesn't end in 'perl').
: 
: *** THIS WOULD MAKE A NICE THING TO ADD IN PATCH 9 LARRY ***

*** OK I ADDED IT TO PATCH 9 TOM ***

: hee hee

ho ho

Another perl hack adjustor,
Larry

P.S. Here's the scoop: if argv[0] contains "perl", and #!WHATEVER doesn't
contain "perl", it will invoke WHATEVER for you.  It will even throw
in the first argument after WHATEVER like it's supposed to.  Note that
it recognizes "perl" anywhere in the WHATEVER, not just at the end.