Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Bad interpreter

Status
Not open for further replies.

Crundy

Programmer
Jul 20, 2001
305
GB
I'm getting the below message when trying to run a perl script:

-bash-3.00$ ./search.pl
: bad interpreter: No such file or directory

But if I run it straight through perl then it's fine:

-bash-3.00$ perl search.pl
Content-type: text/html

So the usual problem is odd characters (e.g. CR / LF) in the shebang line right? But I complelely deleted and rewrote the shebang line and I'm still getting the error. opening the file using vi shows no odd characters. Path to perl seems to be fine:

-bash-3.00$ which perl
/usr/bin/perl

Head of perl script:

#!/usr/bin/perl
use Mysql;
require "subs.cgi";
&parse_form();

Does anyone know what's wrong?


C:\DOS:>
C:\DOS:>RUN
RUN DOS RUN!!
 
Does it do it with every perl script or just that one?

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[noevil]
Travis - Those Who Say It Cannot Be Done Are Usually Interrupted by Someone Else Doing It; Give the wrong symptoms, get the wrong solutions;
 
check your path; echo $PATH and if it's not there add it there, so you can run perl from everywhere.
 
It's definiely in the path, as I ran:

-bash-3.00$ which perl
/usr/bin/perl

A simple hello world script works:

#!/usr/bin/perl
print "Content-type: text/html\n\n";
print "Hello world!!";

So it must be odd characters somewhere. Unfortunately I can't seem to find them or get rid og them. The server doesn't have dos2unix installed either.

C:\DOS:>
C:\DOS:>RUN
RUN DOS RUN!!
 
Nevermind, I managed to get the administrator to install dos2unix and it's working now.

C:\DOS:>
C:\DOS:>RUN
RUN DOS RUN!!
 
Normally on a windows machine it doesn't need dos2unix but needs to have .pl scripts associated to perl (which dos2unix might being doing for you). The #! line is ignored in the windows enviroment. If you need a windows perl I would suggest activestate above all else. It's free and it has great module support. If I remember correctly dos2unix has a pretty old version and you are going to have to manually compile and scripts.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[noevil]
Travis - Those Who Say It Cannot Be Done Are Usually Interrupted by Someone Else Doing It; Give the wrong symptoms, get the wrong solutions;
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top