I\'m trying to run a sh script and get the following error on Mac:
/usr/bin/perl^M: bad interpreter: No such file or directory
How
/usr/bin/perl^M:
Remove the ^M at the end of usr/bin/perl from the #! line at the beginning of the script. That is a spurious ASCII 13 character that is making the shell go crazy.
Possibly you would need to inspect the file with a binary editor if you do not see the character.
You could do like this to convert the file to Mac line-ending format:
$ vi your_script.sh
once in vi type:
:set ff=unix
:x