In this tutorial, How to solve bad interpreter when running the shell exit with “bad interpreter: /bin/sh^M: no such file or directory“. I will be using three methods. Linux the essential for DevOps Roles.
bad interpreter: /bin/sh^M: no such file or directory fixed
Method 1: Using vim editor
Open vim and insert the following command
:set fileformat=unix
:x
Or
:set ff=unix
:x
Method 2: Using sed command
[huupv@huupv devopsroles]$ sed -i 's/\r//' FILE_NAME
Method 3: I Using dos2unix command
[huupv@huupv devopsroles]$ dos2unix FILE_NAME
Conclusion
Thought the article, You have solved the problem “bad interpreter: /bin/sh^M: no such file or directory” as above. I hope will this your helpful. Thank you for reading the DevopsRoles page!