./configure : /bin/sh^M : bad interpreter [duplicate] ./configure : /bin/sh^M : bad interpreter [duplicate] bash bash

./configure : /bin/sh^M : bad interpreter [duplicate]


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

:set fileformat=unix

Finally save it

:x! or :wq!


Looks like you have a dos line ending file. The clue is the ^M.

You need to re-save the file using Unix line endings.

You might have a dos2unix command line utility that will also do this for you.


Or if you want to do this with a script:

sed -i 's/\r//' filename