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:
[crayon-5d85e3185d3d7408374294/]
Finally save it
[crayon-5d85e3185d3dc932088305/]

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