/bin/bash^M: bad interpreter: No such file or directory

Posted on November 24th, 2008 by Luke Sheldrick.
Categories: IT / Tech.
Tags: , , .

24 11 2008

If you’re getting the above errors, when you try to run a .sh or similar [I’ve seen it with perl scripts too] this is will be due to the file being in dos [windows] format, and probably written in notepad or similar.

If you need to get this into unix format, it can be pretty painless, just run the command

dos2unix filename

dos2unix should be available under most releases of linux. Happy coding.



Comment on September 3rd, 2009.

Genius thank you 🙂


Comment on February 4th, 2011.

Life…saver… Thank you!


Comment on August 12th, 2011.

This is the second time I’ve been here for that fix. I forgot about it since the last time!

Leave a comment

Comments can contain some xhtml. Names and emails are required (emails aren't displayed), url's are optional.