TI

How to fix a /bin/sh^M : bad interpreter error

How to fix a /bin/sh^M : bad interpreter error

Sometimes if you execute a script via the CLI you get following error /bin/sh^M : bad interpreter.

This is because of the line endings in your file are DOS line endings. The clue is the ^M. What you need to do is just re-save the file using Unix line endings.

To fix this, open your script with vi or vim and enter in vi command mode (key ESC), then type this:

Finally save it

fonte: http://tombevers.me/2012/05/17/how-to-fix-a-binshm-bad-interpreter-error/