Welcome to the GoFuckYourself.com - Adult Webmaster Forum forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Post New Thread Reply

Register GFY Rules Calendar
Go Back   GoFuckYourself.com - Adult Webmaster Forum > >
Discuss what's fucking going on, and which programs are best and worst. One-time "program" announcements from "established" webmasters are allowed.

 
Thread Tools
Old 10-10-2002, 07:38 AM   #1
HQ
Confirmed User
 
Join Date: Jan 2001
Posts: 3,539
how can you tell dos newlines from linux newlines?

How can I tell if a file has DOS newlines or Linux newlines?
HQ is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 10-10-2002, 07:47 AM   #2
Calvinguy
Confirmed User
 
Join Date: Oct 2002
Location: European Union
Posts: 1,752
I'm sure of dos but windows is \r and unix is \n
Calvinguy is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 10-10-2002, 07:50 AM   #3
HQ
Confirmed User
 
Join Date: Jan 2001
Posts: 3,539
What do you mean? I have a bunch of cgi files and I want to know if they have DOS newlines or Linux newlines in them. I tried "cat filename.cgi" and it does not seem to show a difference from one to the other. I may be mistaken as I can not tell what file is what.
HQ is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 10-10-2002, 07:54 AM   #4
Calvinguy
Confirmed User
 
Join Date: Oct 2002
Location: European Union
Posts: 1,752
Try to open the files in windows notepad or wordpad.

If it looks fine it's windows newline \r

If there is a square box in the end every line it's unix newline \n.
Windows can't handle unix newlines and fuckup and show a square instead. Some default ascii char.

I'm not sure if it helps.

Last edited by Calvinguy; 10-10-2002 at 07:56 AM..
Calvinguy is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 10-10-2002, 07:57 AM   #5
FuqALot
Confirmed User
 
Join Date: Dec 2001
Location: Malibu
Posts: 3,817
Quote:
Originally posted by HQ
How can I tell if a file has DOS newlines or Linux newlines?
If it uses \n as newline, then it's a UNIX newline, if it uses \r\n then it's a DOS newline.
FuqALot is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 10-10-2002, 09:30 AM   #6
HQ
Confirmed User
 
Join Date: Jan 2001
Posts: 3,539
Quote:
Originally posted by Calvinguy
Try to open the files in windows notepad or wordpad.

If it looks fine it's windows newline \r

If there is a square box in the end every line it's unix newline \n.
Windows can't handle unix newlines and fuckup and show a square instead. Some default ascii char.
Thanks, but the problem with this is that you never know if your FTP client is converting it. So what I meant to ask was: how do I do this on my server (in Linux) without downloading it?

Last edited by HQ; 10-10-2002 at 09:34 AM..
HQ is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 10-10-2002, 09:42 AM   #7
Carrie
Confirmed User
 
Join Date: Apr 2002
Location: Virgin - nee
Posts: 3,162
If your script isn't working and it says to make sure there are no newlines in it, check the comments and make sure that nothing's wrapped while you were editing it in pico.
#A comment should look like this
#A comment should not take up
two lines like this

Make sure you uploaded it in ASCII format. Make sure it's chmoded to 755. Make sure the shebang line has the correct path to perl for your server (if you don't know what it is, do a "whereis perl" while you're in a shell).
Carrie is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 10-10-2002, 09:46 AM   #8
HQ
Confirmed User
 
Join Date: Jan 2001
Posts: 3,539
My CuteFTP Pro is set for ASCII uploads on *.cgi files by default and it did not do this for some reason. I am still working on the problem.

Using Webmin's File Manager I can save the files to my Windows computer and view them in Notepad (but not Wordpad) to see if the files are Linux or DOS newlines. Linux newlines do not work in Notepad.

Thanks for all your help.
HQ is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 10-10-2002, 09:48 AM   #9
HQ
Confirmed User
 
Join Date: Jan 2001
Posts: 3,539
Quote:
Originally posted by Carrie
Make sure you uploaded it in ASCII format. Make sure it's chmoded to 755. Make sure the shebang line has the correct path to perl for your server (if you don't know what it is, do a "whereis perl" while you're in a shell).
I did all this. When I run "dos2unix" on my scripts they all-of-a-sudden work, so this means the problem is the newlines only.
HQ is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 10-10-2002, 11:37 AM   #10
HQ
Confirmed User
 
Join Date: Jan 2001
Posts: 3,539
Is is *ever* possible for a cgi script to run with DOS newlines in it? I have proof that a few of my scripts actually ran like this, but it makes no sense to me at all. Perhaps if a cronjob runs the script it works on DOS newline scripts???
HQ is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Post New Thread Reply
Go Back   GoFuckYourself.com - Adult Webmaster Forum > >

Bookmarks



Advertising inquiries - marketing at gfy dot com

Contact Admin - Advertise - GFY Rules - Top

©2000-, AI Media Network Inc



Powered by vBulletin
Copyright © 2000- Jelsoft Enterprises Limited.