[comp.unix.questions] #! problems

protofan@motcid.UUCP (Mike S. Protofanousis) (03/29/91)

I'm trying to make a perl script an executable script.

However, it seems that ESIX does not support the #!/usr/local/bin/perl
notation.

I tried
: use /usr/local/bin/perl

and that didn't work either!  When I use the ':' notation, the script is
executed under normal 'sh'.  For example, if I'm using csh, putting a ':' 
on the first line of a Bourne shell script makes it work properly.

What do I need to do so that I don't have to type 'perl script' to run
my perl script?  No, I don't want to use an alias.

Thanks.

-- 
Mike Protofanousis
msp@pronet.chi.il.us
motcid!protofan@uunet.uu.net

merlyn@iwarp.intel.com (Randal L. Schwartz) (03/29/91)

In article <4723@cocoa7.UUCP>, protofan@motcid (Mike S. Protofanousis) writes:
| What do I need to do so that I don't have to type 'perl script' to run
| my perl script?  No, I don't want to use an alias.

This is on the manpage, as well as being (at least twice) in The Book.
Put:

      eval '(exit $?0)' && eval 'exec /usr/bin/perl -S $0 ${1+"$@"}'
      & eval 'exec /usr/bin/perl -S $0 $argv:q'
            if 0;

at the beginning of your program.  Be sure to make the file executable
(chmod +x filename).

print "Just another Perl hacker,"
-- 
/=Randal L. Schwartz, Stonehenge Consulting Services (503)777-0095 ==========\
| on contract to Intel's iWarp project, Beaverton, Oregon, USA, Sol III      |
| merlyn@iwarp.intel.com ...!any-MX-mailer-like-uunet!iwarp.intel.com!merlyn |
\=Cute Quote: "Intel: putting the 'backward' in 'backward compatible'..."====/

pjh@mccc.edu (Pete Holsberg) (03/30/91)

In article <1991Mar28.215544.5391@iwarp.intel.com> merlyn@iwarp.intel.com (Randal L. Schwartz) writes:
=In article <4723@cocoa7.UUCP>, protofan@motcid (Mike S. Protofanousis) writes:
=| What do I need to do so that I don't have to type 'perl script' to run
=| my perl script?  No, I don't want to use an alias.
=
=This is on the manpage, as well as being (at least twice) in The Book.
=Put:
=
=      eval '(exit $?0)' && eval 'exec /usr/bin/perl -S $0 ${1+"$@"}'
=      & eval 'exec /usr/bin/perl -S $0 $argv:q'
      ???  not && ??

Pete
-- 
Prof. Peter J. Holsberg      Mercer County Community College
Voice: 609-586-4800          Engineering Technology, Computers and Math
UUCP:...!princeton!mccc!pjh  1200 Old Trenton Road, Trenton, NJ 08690
Internet: pjh@mccc.edu	     Trenton Computer Festival -- 4/20-21/91

pjh@mccc.edu (Pete Holsberg) (03/30/91)

In article <1991Mar28.215544.5391@iwarp.intel.com> merlyn@iwarp.intel.com (Randal L. Schwartz) writes:
=In article <4723@cocoa7.UUCP>, protofan@motcid (Mike S. Protofanousis) writes:
=| What do I need to do so that I don't have to type 'perl script' to run
=| my perl script?  No, I don't want to use an alias.
=
=This is on the manpage, as well as being (at least twice) in The Book.

That's not what's in *my* copy of "the book"!!

Pete
-- 
Prof. Peter J. Holsberg      Mercer County Community College
Voice: 609-586-4800          Engineering Technology, Computers and Math
UUCP:...!princeton!mccc!pjh  1200 Old Trenton Road, Trenton, NJ 08690
Internet: pjh@mccc.edu	     Trenton Computer Festival -- 4/20-21/91