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?
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.
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.
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.
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.
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).
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”.
Change it to “\n”.