[comp.unix.sysv386] #! 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'..."====/