LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
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.

Notices


Reply
  Search this Thread
Old 12-31-2005, 12:31 AM   #1
apachedude
Member
 
Registered: Aug 2004
Location: California
Distribution: SuSE 10.0 (SUPER)
Posts: 356

Rep: Reputation: 31
Linux is bizarre--path informations of scripts


I have two files, which for a lack of better name, I have called test2.cgi and test3.cgi.

test2.cgi:
Quote:
#!/usr/bin/perl

print "Content-type: text/html\n\nHello, world\n";
test3.cgi:
Quote:
#!/usr/bin/perl

print "Content-type: text/html\n\nHello, world\n";
As you can see, they have the exact same content, but somehow, ./test2.cgi cannot be interpreted by the shell, while ./test3.cgi is correctly interpreted. They have the exact same chmod 755 permissions. I even copy and pasted the contents of the file just to make sure they were the same.

I also ran diff test2.cgi test3.cgi
Quote:
1,3c1,3
< #!/usr/bin/perl
<
< print "Content-type: text/html\n\nHello, world\n";
---
> #!/usr/bin/perl
>
> print "Content-type: text/html\n\nHello, world\n";
What in ther world does this mean? This is really frustrating.
 
Old 12-31-2005, 01:27 AM   #2
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682
I wonder if there is a hidden whitespace or a encoding problem? How were the two files created? Which editor are you using?
 
Old 12-31-2005, 01:45 AM   #3
apachedude
Member
 
Registered: Aug 2004
Location: California
Distribution: SuSE 10.0 (SUPER)
Posts: 356

Original Poster
Rep: Reputation: 31
I'm using Kate. I think (but am not sure) that test2.cgi was a copy of a file that I created in Windows (and uploaded to a remote UNIX server). test3.cgi was typed in from scratch. Then, I got a message : bad interpreter: No such file or directory for test2.cgi. I then copied the contents of test3.cgi (select-all, copy) and pasted it into test2.cgi, overwriting the previous test2.cgi. That does not work either.

I think it is worth noticing that test2.cgi is 68 bytes and test3.cgi is 71 bytes according to ls -al. Also, all copies of test2.cgi (from cp, as opposed to copy and paste) do not work while all copies of test3.cgi work.
 
Old 12-31-2005, 01:49 AM   #4
apachedude
Member
 
Registered: Aug 2004
Location: California
Distribution: SuSE 10.0 (SUPER)
Posts: 356

Original Poster
Rep: Reputation: 31
Actually, you are correct. It's a UNIX vs. Windows/DOS end of line problem. And I was mistaken. test2.cgi worked ifne but test3.cgi didn't. I think the problem is solved now. I'm not sure why I didn't think of it before.
 
  


Reply



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
I would like to modify informations about me :) zahadumy Linux - Newbie 5 05-26-2005 02:00 PM
scripts can't find path corbis_demon Linux - General 2 09-08-2004 06:11 PM
put my scripts to PATH Boby Linux - Newbie 1 06-14-2004 12:01 PM
Technical Informations nbjayme Mandriva 4 02-19-2004 08:11 AM
Changing PATH on the fly in BASH scripts pioniere Programming 1 06-17-2003 04:52 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 04:32 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