lkml.org 
[lkml]   [1999]   [Mar]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [OFFTOPIC] #!perl - alternative path to script interpreters
Date
From
Tom Holroyd wrote:
> (I wrote:)
> >===
> >#!/bin/sh
> >
> >eval 'exec perl -w -S $0 ${1+"$@"}'
> > if 0;
> >===
>
> "If the #! line does not contain the word "perl", the
> program named after the #! is executed instead of the Perl
> interpreter." [perl 5.004_01]
>
> So this would never work, nor would the "continued comment" trick they use
> with Tcl.

Ahhh. Hence the other bit I remembered but couldn't find. There is
some trick to put the word perl on the first line in a way it will be
ignored. I couldn't remember what it was or why so I left it out and just
changed /usr/bin/perl to /bin/sh (the script I quoted from was #!/usr/bin/perl
originally) :-(

It is something which people typically put -*- perl -*- or something in but I
don't know if that's just because it looks nice, and I can't find any
examples around :-(

try something like

#!/bin/sh -f - -- perl
and the above

Another alternative - see /usr/bin/texi2html

This program is valid nroff input, etc, but is really a perl script:

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

'di ';
'ig 00 ';
===

Anyway. There is a userspace solution. Or many of them. And they're
portable.

David.


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 13:50    [W:0.089 / U:0.784 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site