📜 ⬆️ ⬇️

One solution to perl ^ M bad interpeter

If you run a pearl barley script in Unix, in which #! / Usr / bin / perl in the first line is not "\ n" at the end, but "\ r \ n",
then bash will give an error:

perl^M bad interpeter

You can replace "\ r \ n" with "\ n" with the following line:

perl -i -pe "s/\r|\n//g; binmode ARGVOUT" file.txt

Or you can simply create a symlink with the name “perl \ r” pointing to / usr / bin / perl:
')
ln -s /usr/bin/perl `perl -e 'print "/usr/bin/perl\r"'`

Source: https://habr.com/ru/post/71344/


All Articles