sh/bin bad interpreter- No such file or directory

If a script you are trying to run returns :

sh/bin bad interpreter: No such file or directory

Try this :

dos2unix filename

Before dos2unix :

head -1 filename | od -c
should return :
0000000   #!   /   b   i   n   /   s   h  r  n
0000013

After dos2unix :

head -1 filename | od -c
should return :
0000000   #!   /   b   i   n   /   s   h  n
0000013

Noticed the r character ? That’s what turned out to be the problem..

You can find more info about the “newline” character at Wikipedia. To make a long story short, Windows systems use “rn” to create a new line while Unix systems use “n” alone.

Files edited under Windows systems could be “corrupted” by this small issue, reason of the dos2unix tool.

You may need to convert a Unix file into a Windows file with the unix2dos command.




Thanks for reading this post!


Did you find an issue in this article?

- click on the following Github link
- log into Github with your account
- click on the line number containing the error
- click on the "..." button
- choose "Reference in new issue"
- add a title and your comment
- click "Submit new issue"

Your feedback is much appreciated! πŸ€œπŸΌπŸ€›πŸΌ

You can also drop me a line below!