Messages in this thread | | | Date | Tue, 23 Mar 1999 20:12:19 -0600 (CST) | From | "Edward S. Marshall" <> | Subject | Re: #!perl - alternative path to script interpreters - patch to 2.2 |
| |
On Tue, 23 Mar 1999, Jakob 'sparky' Kaivo wrote: > What's wrong with people following the FHS, which specifies that perl is > accessible at /usr/bin/perl, python at /usr/bin/python, and tcl at > /usr/bin/tcl?
Portability, which is what started this whole discussion in the first place. Try taking the script:
#!/usr/bin/perl -w print "Hello, world!\n";
and running it unmodified on the multitude of UNIX variants out there.
The 'eval' trick is a much more portable way of doing it:
: # -*- Perl -*- eval 'exec perl -w -S $0 ${1+"$@"}' if 0;
print "Hello, world!\n";
More readable, no. More portable? Absolutely. You'll be hard-pressed to find a UNIX variant this doesn't actually run on.
-- Edward S. Marshall <emarshal@logic.net> [ What goes up, must come down. ] http://www.logic.net/~emarshal/ [ Ask any system administrator. ]
Linux labyrinth 2.2.3-ac4 #2 Sun Mar 21 13:08:37 CST 1999 i586 unknown 8:05pm up 2 days, 4:26, 3 users, load average: 0.09, 0.06, 0.01
- 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/
| |