Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

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).


This post first appeared on Ubuntu Tutorials, please read the originial post: here

Share the post

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

×

Subscribe to Ubuntu Tutorials

Get updates delivered right to your inbox!

Thank you for your subscription

×