How do I fix 'bad interpreter' error messages when trying to run shell scripts?
More often than not, this error indicates that the script in question has been written on a machine which inserted CR/CRLF's into the script (old MS-DOS style newline/linefeeds). Sometimes they appear as ^M's in the file where a newline is defined. Try running the command:
dos2unix <script name>
The command should return a prompt after it completes. Try run...
Subscriber exclusive content
A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.