The output isn’t very helpful and almost gives the impression your script is missing.

Fortunately, that’s not the case, and the fix is very simple.

What Is the “Bad Interpreter: No Such File or Directory” Error?

Person typing on the Cherry KW 9200 Mini Keyboard

Hannah Stryker / How-To Geek

you might even confirm the problem in a Linux terminal by pointing thefilecommand to your script.

Fortunately, getting back in LF business is easy.

you’ve got the option to do this with terminal commands or in your favorite code editor.

A “bad interpreter: no such file or directory” error message in a Linux command line.

Check it withfileif you want to confirm the conversion was successful before running your script.

You also can mass-convert by naming multiple files separated by only a space.

Thedos2unixcommand has several flags to help you make special kinds of conversions, likechanging file ownership.

Check a file’s line endings with the file command in Linux.

you might even use it in reverse form,unix2dos, if you want to switch back to CRLF.

Enterdos2unix –helpto learn more.

Withthetrcommand, you could strip out the\rpart of the line endings so we’re left with\nterminators.

Enter the dos2unix command.

Using the sed Command

The mightysedcommandbuilt into your shell can also change line endings for your file.

That leaves us with Unix’s preferred\nline terminators.

Virtually every code editor andIDEout there has a toggle for line endings.

Change the script file format with a vim command.

store your script and try running it again.

Save the file and run your script again.

With the file open, go to Edit > EOL Conversion > Unix (LF).

In Geany, under the Document menu, go to “Set Line Endings” and choose “Convert and Set to LF (Unix)”.

Be sure to stash your script before running it.

Just click “CRLF” at the bottom-right corner of VS Code’s window.

The top result should be a drop-down menu for setting the “Eol”.

In Kwrite, in the Tools menu open “End of Line” and select “Unix."

Change it to “\n”.

Click “Edit” in Notepad++ and under “EOL Conversion” click “Unix (LF)."

In Notepad++ preferences, go to “New Document” and click “Unix (LF)."

Click “CRLF” at the bottom of the VS Code screen.

In VS Code settings, change the default EOL setting.