Linux - NewbieThis 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.
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.
[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]#
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
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.
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?
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?
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.
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.
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?
^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.
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??
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.