[pm-h] newbie confusion: executing a perl script
Russell L. Harris
rlharris at oplink.net
Mon Aug 4 08:43:51 PDT 2008
* G. Wade Johnson <gwadej at anomaly.org> [080804 07:21]:
>> year. But when I attempted to execute the script bash returned an
>> error message:
>>
>> $ ./gus_morse.pl --path ~/scratch/message.txt
>>
>> bash: ./gus_morse.pl: /usr/bin/perl^M: bad interpreter: No such
>> file or directory
> The error message actually tells you exactly what you need to know. The
> perl program it is trying to run is wrong, because it has a carriage
> return in the name.
>
> This is usually caused by trying to run a DOS/Windows formatted file on
> some UNIX flavor.
>
> Run dos2unix on the script.
Thanks, Wade. You solved the problem.
Upon encountering the error, the first thing I did was to search for
control-M using Emacs, and nothing was found; obviously I need to read
over the section of the Emacs manual which covers searching for
control characters.
I had good reason to believe that the author of the script was running
Linux, but I suppose that running dos2unix is a worthwhile precaution
for any script which is downloaded from the web.
A while back, a Perl script which I wrote appeared to be behaving
pathologically, until I discovered that the text files which I was
attempting to process (and, indeed, was processing with a great
measure of success) had been generated on a DO$/Window$ system.
Regards,
RLH
More information about the Houston
mailing list