saintmike has asked for the wisdom of the Perl Monks concerning the following question:
and running it from the command line using#!/usr/bin/perl print "hello\n";
will use the perl interpreter perl specified on the command line to run the script, no doubt. Same holds true for$ perl script.pl
but I was surprised to see that#!/some/weird/line/containing/perl print "hello\n";
when put into script.py and run via#!/usr/local/bin/python print "python!"
(note the perl on the command line) will call the python interpreter without complaining! Also, a script like$ perl script.py
will throw an error message:#!Some Weird Comment print "perl!";
So, the deal is that if the shebang line contains the pattern perl somewhere, perl will actually run the script, whereas when it doesn't contain the perl pattern, it will try to run whatever's specified on the shebang line?$ perl script.pl Can't exec Some at t1 line 1.
Anybody knows more about this?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Shebang Line Weirdness
by Eimi Metamorphoumai (Deacon) on Nov 17, 2004 at 22:19 UTC |