Last Updated on 23 August 2022 by Roberto De Pedrini
Trying to run scripts to manage IBM i Web Services (directory / QIBM / ProdData / OS / WebServices / bin) from a Putty SSH session I get an error
./ myscript.sh: / usr / bin / qsh ^ M: bad interpreter: No such file or directory
Doing some research on Google I discover that the problem is due to the “file-format” of the script file.
To solve the problem we can do one of these 3 things:
Launch the same command from a 5250 QSH / STRQSH sessionModify the file-format with VIM (advanced version of the VI editor) in interactive command mode (see https://www.ibm.com/support/pages/how-fix-usrbinkshm-bad-interpreter-when-using-ibm-content-manager )vim myscript.sh: set fileformat = unix: wqModify the file-format with VIM but in command-line mode (see https://stackoverflow.com/questions/21828093/need-to-write-a-script-to-change-file-format-from-dos-to-unix )vim -c “wq ++ ff = unix” myscript.sh
HTH
—
Roberto De Pedrini
Faq400.com