On Tue, 26 Feb 2002, Alan Mead wrote: >Is the file format dos or unix? An easy way using vi (you may be deluged >with alternatives) is to edit the file (e.g., 'vi scriptname.pl'), then type >':set fileformat=unix', then enter, then write the file (':wq' or 'ZZ' will >write and quit). I have found that newline differences can confuse perl (or >maybe bash) and 'dos' style newlines are common.
I haven't used it in a while (I usually use Emacs to do the above, instead) but dos2unix should do the trick. D. >-Alan > >----- Original Message ----- >From: David Archer <[EMAIL PROTECTED]> >To: <[EMAIL PROTECTED]> >Sent: Tuesday, February 26, 2002 10:44 PM >Subject: Downloaded Perl Scripts > > >> I sometimes have a problem running downloaded perl scripts. If I type >> something like "perl scriptname.pl" for one of these problem scripts, it >> runs fine. When I try "./scriptname.pl" I get the following: >> >> bash: ./scriptname.pl: No such file or directory >> >> the first line does contain "#!/usr/bin/perl" just like my scripts that >> run fine. I've run into this before, but never found a solution. >> Retyping the script (if it is a short one) usually results in the script >> working. This really isn't an option on longer scripts. I also do a >> chmod 755 on all the downloaded perl scripts (to cover some of the >> obvious questions). I have tried this as root and as an ordinary user. >> >> When trying to run these problem scripts from apache (with owner and >> group set to apache) I get the following in /var/log/httpd/error_log: >> >> [Tue Feb 26 20:22:17 2002] [error] (2)No such file or directory: exec of >> /var/www/cgi-bin/scriptname.pl failed >> [Tue Feb 26 20:22:17 2002] [error] [client 24.234.44.166] Premature end >> of script headers: /var/www/cgi-bin/scriptname.pl >> >> Any suggestions? >> >> thanks, >> >> David Archer >> >> >> >> _______________________________________________ >> Redhat-list mailing list >> [EMAIL PROTECTED] >> https://listman.redhat.com/mailman/listinfo/redhat-list >> > > > > >_______________________________________________ >Redhat-list mailing list >[EMAIL PROTECTED] >https://listman.redhat.com/mailman/listinfo/redhat-list > _______________________________________________ Redhat-list mailing list [EMAIL PROTECTED] https://listman.redhat.com/mailman/listinfo/redhat-list