Download your favorite Linux distribution at LQ ISO.
Go Back > Forums > Linux Forums > Linux - Software
User Name
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.


  Search this Thread
Old 05-11-2002, 07:02 PM   #1
LQ Newbie
Registered: May 2002
Location: Iowa
Distribution: Slack, Debian
Posts: 4

Rep: Reputation: 1
Question Problem with a perl script

i have a problem, im trying to run a perl script, but all i seem to get is this error code
bash: ./install: bad interpreter: No such file or directory

somone on irc was trying to help me, but he disconnected and was not able to finish, here is a copy/paste of what he was having me do.

root@Aura:/var/www/cgi-bin# head -n1 ./install
root@Aura:/var/www/cgi-bin# which perl
root@Aura:/var/www/cgi-bin# which sh
root@Aura:/var/www/cgi-bin# ln -s /usr/local/bin/perl /usr/bin/perl
ln: `/usr/bin/perl': File exists
root@Aura:/var/www/cgi-bin# ls -l /bin/sh
lrwxrwxrwx 1 root root 4 May 9 18:35 /bin/sh -> bash
root@Aura:/var/www/cgi-bin# ls -l /bin/bash
-rwxr-xr-x 1 root bin 518140 Apr 10 2001 /bin/bash

any help on this head ache would help.


The system is Slack 8.0 with Kernel 2.4.5
Perl version 5.6.1
Old 05-11-2002, 11:56 PM   #2
LQ Addict
Registered: Jun 2001
Posts: 1,183

Rep: Reputation: 47
Shouldn't the first line of your perl script be the path to perl? Like this #!/usr/local/bin/perl instead of #!/bin/sh.
Old 05-12-2002, 09:07 AM   #3
Registered: Apr 2002
Location: Brazil
Distribution: Slackware
Posts: 184

Rep: Reputation: 30
You may use this nice (nasty?) trick, to keep your script portable and functional:

# \
exec perl "$0" "$@"


Old 08-08-2002, 09:51 PM   #4
LQ Newbie
Registered: Aug 2002
Posts: 6

Rep: Reputation: 0
Don't know if anyone made this discovery yet....

I had the same problem and made the following discovery
about the script I was trying to execute but was receiving the 'bad interpreter' message (Redhat Linux 7.3].
The script looked fine when I opened it in vi, btw.
and I could execute the script fine by calling it directly with
perl (it was a perl script).

When you invoke vi in Linux, the editor "vim" is invoked
(because of the alias vi=vim).
vim recognizes both dos and unix file formats.
When I vi'd the file, it appeared fine but the
fileformat (when you first open) stated the file was [dos].
I issued command ":set fileformat=unix" in vi (vim) and
saved. After that, the script ran fine.

Bottom line is the file hae the dos end-of-line character(s) instead
of the unix newline. I guess Perl handles the dos format but bash
does not.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem with perl module for w3c validator to work on my local Apache+PHP+perl instal tbamt Linux - Software 0 12-16-2004 06:37 PM
Converting a Windows Perl script to a Linux Perl script. rubbercash Programming 2 07-19-2004 11:22 AM
how to find the pid of a perl script from shell script toovato Linux - General 1 12-19-2003 07:25 PM
Have problem running .pl perl script in apache adrianmak Linux - Software 4 11-10-2003 10:31 AM
Including methods from a perl script into another perl script gene_gEnie Programming 3 01-31-2002 06:03 AM > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 03:46 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration