Eclipse file saving and /bin/bash^M: bad interpreter
The source of the error is having a bash file saved with line delimiter in Windows style rather the Unix format. To fix this you can use the 'dos2unix' linux utiltiy:
$> aptitude install dos2unix The following NEW packages will be installed: dos2unix 0 packages upgraded, 1 newly installed, 0 to remove and 0 not upgraded. $> dos2unix <file_to_fix>.sh dos2unix: converting file <file_to_fix>.sh to UNIX format ...
Eclipse new line delimter setting
But this post is about setting the Eclipse IDE to save in the Unix format, so let's get to it.
To do so, right click on the 'project' in your navigation pane, select 'properties', and under the 'Resource' tab ensure to specify the 'New text file line delimiter' is set to Unix as shown above; while you at it select the same encoding as on your server which most likley is UTF-8.
If you have 'Preferences > General > Editors > Text Editors > Show whitespace characters' enabled then you will be able to notice the encoding at a glance.
Do plus +1, comment, or share this if it helped you.