Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Unix Windows differences

Status
Not open for further replies.

nivone

Programmer
Jul 2, 2002
33
IL
HI,

I am going to write scripts for people, some use Windows, some use Unix.
I want to write the scripts on Windows. Is there a special text editor that I should use to make sure that the scripts will work on both platforms?
I heard there is a problem with Windows LF/CR. And I saw scripts that they seem like a one long line.
In general, can I write safely scripts with notepad and be sure that they will work? (beside the first line which indicates where Perl is installed).

Thanks,

Nivo
 
Check out this Google Thread. It presents several different solutions to this problem.

Summary:

transfer files back and forth in ftp ascii mode
use a better text editor that convert between dos/unix
use a perl script to strip or add the \r character
 
Two other general tips:

1) Do not depend on OS specific features. For example, don't call 'sendmail' to send email, use Net::SMTP.

2) Make sure your file paths are very configurable by the user or the script detects its OS and changes file paths accordingly. E:\bla\bla\bla won't work under unix and /var/log/messages will bomb under windows.

Good luck! I use EditPlus and have not had a problem with linefeeds.
 
HI,

Well, I've written and published my script, I saved it using TextPad as Unix, but I don't have a way to verify that it works under unix.
The link to the download page is:
It's a nice script for managing a news page for web managers, I could realy use hints on how to make it as valid as possible for Unix.
If someone has access to Unix server I would deaply appriciate it if he could install it and let me know what I'm doing wrong.
It's a huge request, I know, I'll understand if no one would do that, but I realy need help here.

Thanks,

Nivo
 
I downloaded it and ran the perl scripts at command line. I am not checking for content but they passed the interpreter, produced output and the line feeds seem correct.

My only thing would be to

A) put the files in a directory within the archive, I unzip'd it in a user dir and it just threw everything at that same level which is not 'polite' in a unix environment. it should create a directory 'newsflash' and have the files within that.

B) Use tar and gzip instead of zip

Looks fine though
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top