Perl scripts on systems without "#!"

Tom Neff tneff at bfmny0.UU.NET
Fri Nov 3 07:17:59 AEST 1989


In article <255072E0.20005 at ateng.com> chip at ateng.com (Chip Salzenberg) writes:
>Therefore, all Perl scripts on my system begin with these two lines:
>
>    eval 'exec /bin/perl -S $0 ${1+"$@"}'
>       if $running_under_some_shell;
>
>I have yet to extend this method in a way that works for the C shell.  If I
>could do so, then starting the script with "#!" would work on Xenix.  Does
>anyone out there have an idea?

According to my notes, CSH looks for a colon ':' as the first token
in a script and passes it on to /bin/sh if the colon is seen.  So perhaps

	:
    eval 'exec /bin/perl -S $0 ${1+"$@"}'
       if $running_under_some_shell;

would do the trick.  But the problem here is that PERL hates the colon!
So you could set up a script like this for script execution, but not
feed it to perl unmodified.

Perl being still under modification, perhaps it could be fixed to accept
this.  Or is there a clever perl-ism that would let us put the colon there.
-- 
I'm a Leo.  Leos don't believe    *  *  *     Tom Neff
    in this astrology stuff.        *  *  *   tneff at bfmny0.UU.NET



More information about the Alt.sources.d mailing list