LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 08-02-2003, 06:45 PM   #16
DKY
Member
 
Registered: Jul 2003
Posts: 60

Original Poster
Rep: Reputation: 15

my permissions on this are at 0777, and I was in the cgi-bin directory, which is where it resides. But I'll try again, maybe I missed something.
 
Old 08-02-2003, 06:48 PM   #17
DKY
Member
 
Registered: Jul 2003
Posts: 60

Original Poster
Rep: Reputation: 15
Here's what I came up with, any ideas?


[root@DKY cgi-bin]# ls
htsearch iBtest.cgi namazu.cgi qtest
[root@DKY cgi-bin]# ./iBtest.cgi
: bad interpreter: No such file or directory
[root@DKY cgi-bin]#
 
Old 08-02-2003, 07:49 PM   #18
stickman
Senior Member
 
Registered: Sep 2002
Location: Nashville, TN
Posts: 1,552

Rep: Reputation: 53
Quote:
Originally posted by DKY
here's what happened when I tried to run the script.
./iBtest.cgi
: bad interpreter: No such file or directory
Vi the file and look for ^M and the end of the lines. If you see them, they need to be removed.
 
Old 08-02-2003, 11:02 PM   #19
DKY
Member
 
Registered: Jul 2003
Posts: 60

Original Poster
Rep: Reputation: 15
Quote:
Originally posted by stickman
Vi the file and look for ^M and the end of the lines. If you see them, they need to be removed.
How does one do that exactly, what does Vi mean?
 
Old 08-02-2003, 11:34 PM   #20
elam
LQ Newbie
 
Registered: Aug 2003
Posts: 21

Rep: Reputation: 15
vi is a text editor.
type vi iBtest.cgi, and it should bring up the file.

You see any ^M? You can delete them with the x key and move around the screen with the ijkl keys.

to save the file, type :w and to quit type :q or more conveniently type :wq.

If you get in any trouble, use the esc key.
Documentation here

You might wanna back up the file first though. vi can be tricky.
 
Old 08-03-2003, 08:08 AM   #21
DKY
Member
 
Registered: Jul 2003
Posts: 60

Original Poster
Rep: Reputation: 15
I couldnt find any ^M, what are those anyway. I looked for it in vi, then I even opened the file in gedit, and used the find function. Nothing I found three of these though. $^O

Last edited by DKY; 08-03-2003 at 08:10 AM.
 
Old 08-03-2003, 09:11 AM   #22
elam
LQ Newbie
 
Registered: Aug 2003
Posts: 21

Rep: Reputation: 15
i found this on google. Might be worth a shot.
I think thats what the ^M's are. Plain text or something. You got this script from a website right?

Last edited by elam; 08-03-2003 at 09:13 AM.
 
Old 08-03-2003, 09:15 AM   #23
DKY
Member
 
Registered: Jul 2003
Posts: 60

Original Poster
Rep: Reputation: 15
yeah, I got it from a website, and it works on my windows server just fine. All I have to do is change the shebang line to point to perl. I dont get it.
 
Old 08-04-2003, 06:14 AM   #24
jharris
Senior Member
 
Registered: May 2001
Location: Bristol, UK
Distribution: Slackware, Fedora, RHES
Posts: 2,243

Rep: Reputation: 47
What's the output of ls -la /usr/bin/perl it sounds be me like its the perl binary that isn't right. The #!/usr/bin/perl line is the very first line yeah? With no white space before it yeah?

cheers

Jamie...
 
Old 08-04-2003, 08:40 AM   #25
DKY
Member
 
Registered: Jul 2003
Posts: 60

Original Poster
Rep: Reputation: 15
here's the output when I open a terminal, and do the above.
Quote:
[root@DKY root]# ls -la /usr/bin/perl
-rwxr-xr-x 2 root root 12572 Feb 18 21:51 /usr/bin/perl
[root@DKY root]#
and the first line looks like so.
#!/usr/bin/perl
there are no spaces, before, I didnt know you couldnt have any anyway. Interesting. What does the terminal I pasted above tell you?
 
Old 08-04-2003, 09:34 AM   #26
jharris
Senior Member
 
Registered: May 2001
Location: Bristol, UK
Distribution: Slackware, Fedora, RHES
Posts: 2,243

Rep: Reputation: 47
It doesn't tell me much to be honest. I was expecting to see either a problem with your #! line or incorrect permissions on the perl binary. The only other thing I can suggest is write yourself a little script from scratch that's just say
Code:
#!/usr/bin/perl -w

print "Hello world\n";
and try running that instead and see if you get the same error.

cheers

Jamie...
 
Old 08-04-2003, 09:46 AM   #27
stickman
Senior Member
 
Registered: Sep 2002
Location: Nashville, TN
Posts: 1,552

Rep: Reputation: 53
The ^M characters (really CTRL-M, but displayed as ^M) come into play when transfering a file from Windows to Linux/Unix. Windows and Linux/Unix deal with the end-of-line and carriage-return differently. You are probably getting the bad interpreter error because it's looking for perl^M instead of perl. If you have them, you might want to run dos2unix on the file or use your favorite sed expression to remove them.
 
Old 08-04-2003, 10:49 AM   #28
DKY
Member
 
Registered: Jul 2003
Posts: 60

Original Poster
Rep: Reputation: 15
hello worlds works, and since I couldnt find any ^M's I thought well, if its any possible linux to windows thing, I'll go redownload the file from the "linux" site, and now everything works. Any idea as to why I didnt see any ^M. Not even after the shebang?
 
Old 08-04-2003, 11:31 AM   #29
stickman
Senior Member
 
Registered: Sep 2002
Location: Nashville, TN
Posts: 1,552

Rep: Reputation: 53
^M is a "hidden" or "unprintable" character. It's a carriage return. You need to make sure that whatever editor you use has a "show hidden characters" mode. ^M are introduced typically when you fetch a file from a Windows system to a Unix/Linux system.
 
Old 08-04-2003, 12:35 PM   #30
DKY
Member
 
Registered: Jul 2003
Posts: 60

Original Poster
Rep: Reputation: 15
when I used vi, I didnt see any ^M . Is there a way to have "show hidden characters" on vi? If so, how? I have a whole bunch of cgi files I want to transfer to this nix box, would it be easier to look for all the ^M's, or a dos2unix, if so.... What's the proper way to use dos2unix, just cd to the directory, and dos2unix filename.cgi??
 
  


Reply


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
Perl Module cant Install sohaib Red Hat 6 12-02-2005 09:22 AM
Unable to install Perl module via CPAN Sparky.Watson Linux - Software 1 08-24-2005 08:23 PM
Install perl module mosh Programming 2 06-21-2004 12:12 PM
Perl and GD module install problem timfair Linux - Software 0 09-17-2003 08:47 PM
perl-module Net::RawIP - install problem nic_d Linux - Software 0 07-06-2002 07:15 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 08:29 PM.

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