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 |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
 |
|
08-02-2003, 06:45 PM
|
#16
|
Member
Registered: Jul 2003
Posts: 60
Original Poster
Rep:
|
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.
|
|
|
08-02-2003, 06:48 PM
|
#17
|
Member
Registered: Jul 2003
Posts: 60
Original Poster
Rep:
|
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]#
|
|
|
08-02-2003, 07:49 PM
|
#18
|
Senior Member
Registered: Sep 2002
Location: Nashville, TN
Posts: 1,552
Rep:
|
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.
|
|
|
08-02-2003, 11:02 PM
|
#19
|
Member
Registered: Jul 2003
Posts: 60
Original Poster
Rep:
|
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?
|
|
|
08-02-2003, 11:34 PM
|
#20
|
LQ Newbie
Registered: Aug 2003
Posts: 21
Rep:
|
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.
|
|
|
08-03-2003, 08:08 AM
|
#21
|
Member
Registered: Jul 2003
Posts: 60
Original Poster
Rep:
|
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.
|
|
|
08-03-2003, 09:11 AM
|
#22
|
LQ Newbie
Registered: Aug 2003
Posts: 21
Rep:
|
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.
|
|
|
08-03-2003, 09:15 AM
|
#23
|
Member
Registered: Jul 2003
Posts: 60
Original Poster
Rep:
|
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.
|
|
|
08-04-2003, 06:14 AM
|
#24
|
Senior Member
Registered: May 2001
Location: Bristol, UK
Distribution: Slackware, Fedora, RHES
Posts: 2,243
Rep:
|
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...
|
|
|
08-04-2003, 08:40 AM
|
#25
|
Member
Registered: Jul 2003
Posts: 60
Original Poster
Rep:
|
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?
|
|
|
08-04-2003, 09:34 AM
|
#26
|
Senior Member
Registered: May 2001
Location: Bristol, UK
Distribution: Slackware, Fedora, RHES
Posts: 2,243
Rep:
|
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...
|
|
|
08-04-2003, 09:46 AM
|
#27
|
Senior Member
Registered: Sep 2002
Location: Nashville, TN
Posts: 1,552
Rep:
|
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.
|
|
|
08-04-2003, 10:49 AM
|
#28
|
Member
Registered: Jul 2003
Posts: 60
Original Poster
Rep:
|
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?
|
|
|
08-04-2003, 11:31 AM
|
#29
|
Senior Member
Registered: Sep 2002
Location: Nashville, TN
Posts: 1,552
Rep:
|
^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.
|
|
|
08-04-2003, 12:35 PM
|
#30
|
Member
Registered: Jul 2003
Posts: 60
Original Poster
Rep:
|
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??
|
|
|
All times are GMT -5. The time now is 05:47 AM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|