Upon attempting to run a .sh script, the following error occurs:
-bash ./example.sh /bin/sh^M: bad interpreter: No such file or directory
The script is not using Unix characters or not formatted for use with a Unix Operating System.
Run the following command from the Terminal in the directory that the .sh file is located:
dos2unix example.sh example_fixed.sh
Attempt to re-run the .sh file and this time the '-bash ./example.sh /bin/sh^M: bad interpreter: No such file or directory' error will not occur.
If the command is unrecognized by the installation of OSX being used, then the attached application can be installed for the Terminal command to function. (dos2unix-5.3.3-0.pkg) The latest version of this application can be downloaded at the following link which is also the source: