Re: #!/Perl question
Quoting Manoj Srivastava (srivasta@debian.org):
> Hi,
> >>"Joey" == Joey Hess <joey@kitenet.net> writes:
>
> >> The following works under more shells (and also is a man page ;-)
> #!/usr/bin/perl -- # -*- Mode: Perl -*- #
> 'di';
> 'ig00';
>
> "true" || eval 'exec perl -S $0 $argv:q';
> eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}'
> & eval 'exec perl -S $0 $argv:q'
> if $running_under_some_shell;
>
> Joey> Yes, but it doesn't address the orginial problem: It will fail if perl is
> Joey> not in /usr/bin.
>
> Well. Just get rid of the #! line, and it works as expected (I
> really shouyld have caught that).
>
> See, if not invoked under Perl, the first two lines are shell
> no-ops, and the third line execs Perl.
>
> I still use parts of the template.
>
> I remember seeing a program that was legel in 7 languages ...
Nice, but you're all more fortunate than me!
~$ uname -a
SunOS tyne 5.4 Generic_101945-61 sun4m sparc
~$ which perl
/usr/bin/perl
~$ cd /usr/bin
/usr/bin$ ls -l perl*
lrwxrwxrwx 1 root other 19 Feb 22 1996 perl -> /usr/local/bin/perl
/usr/bin$ cd /usr/local/bin
/usr/local/bin$ ls -l perl*
lrwxrwxrwx 1 root other 9 Jun 20 1997 perl -> perl4.036 <===
-rwxr-xr-x 1 root other 339420 Dec 15 1995 perl4.036
lrwxrwxrwx 1 root other 11 Jun 20 1997 perl5 -> perl5.00401
-rwxr-xr-x 1 root other 545656 Feb 23 1996 perl5.002
-rwxr-xr-x 1 root other 617948 Jun 20 1997 perl5.00401
-rwxr-xr-x 1 root other 25020 Jun 20 1997 perlbug
-rwxr-xr-x 1 root other 11215 Jun 20 1997 perldoc
Cheers,
--
Email: d.wright@open.ac.uk Tel: +44 1908 653 739 Fax: +44 1908 655 151
Snail: David Wright, Earth Science Dept., Milton Keynes, England, MK7 6AA
Disclaimer: These addresses are only for reaching me, and do not signify
official stationery. Views expressed here are either my own or plagiarised.
Reply to: