Question : Korn shell script failing with “/bin/ksh^M: bad interpreter: No such file or directory” on Redhat 64-bit Linux
Greetings,
I am trying to run a script that uses korn shell, but it is failing with “/bin/ksh^M: bad interpreter: No such file or directory”. If I execute a which ksh, I get /usr/ksh, thus I know it exists. Any thoughts why I am getting this or how to fix it?
Solution: Korn shell script failing with “/bin/ksh^M: bad interpreter: No such file or directory” on Redhat 64-bit Linux
Hi,
your script conatins carriage-return characters at the line ends.
Remove them with
sed ‘s/.$//’ [filename] > [filename].tmp
mv [filename].tmp [filename]
and try again!
wmp