Home Download Ubuntu

Bad "End Of Line" (EOL) for bash script under windows

The other day I was writing a script in Notepad++ under Windows. This file was saved on a linux machine but I had a surprise when I tried to run it. Ubuntu's bash complained about "bash: ./script.sh: /bin/sh^M: bad interpreter: No such file or directory". This  lead me to a stackoverflow post about this problem and how to solve it.

For an already opened document, goto Edit menu, EOL Conversion and select Unix/OSX Format. The file has been converted, you only need to save it and run it.


If you want all your new files to have the Linux EOL, goto Settings, Preferences, click the New Document/Default Directory tab, and under the New Document, Format legend choose Windows/Mac/Linux. All your future text document will have the Linux new line (EOL).

0 comments:

Post a Comment