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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Creating Unix scripts from Windows IDE

Status
Not open for further replies.
Aug 22, 2002
113
FR
Hello,


Is it possible to use a Perl IDE like Komodo on Windows to create scripts directly on Unix machines through a SAMBA share? When I try that, the resulting script always has a “^M” character at the end of each line and the script won’t run.

Anyone knows about a workaround for this?

Thanks.
 
write a short script to rip out the \r or ^M characters

Code:
#!/usr/bin/perl

$file =$ARGV[0];
$/=undef;
open FH, "<$file";
$perlcode=<FH>;
close FH;
$perlcode=~ s/\r//g;
open FH, ">$file";
print FH "$perlcode";
close FH;

This isn't tested, but should be used as a command line script

There are tools like DOS2UNIX which would do the same

HTH
--Paul
 
angelshark,

Some text editors have an option to save your script files in UNIX rather than DOS format - is there an option like that in Komodo?

Mike

"Deliver me from the bane of civilised life; teddy bear envy."

Want to get great answers to your Tek-Tips questions? Have a look at faq219-2884

 
Paul - thanks for script.

There’s no option in Komodo to save the script in Unix format. However I have found a workaround:

1. Create the script file in the Unix machine and add only the first line (#!/usr/bin/perl), save and close the file.
2. Open the file from the Windows machine using Komodo and work on the script.

Using this method no “^M” character will be appended to the end of each line after saving the script in Komodo.

Thanks.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top