Saturday, April 01, 2017

line ending issue for Linux bash script - bad interpreter

Faced the issue of

/bin/bash^M: bad interpreter: No such file or directory

on Linux Mint, for a copy-pasted file from Windows. I knew that this was most probably due to a CR-Linefeed issue. The default text editor, xed, did not seem to fix it. Finally, as this page suggested, used
:set ff=unix
in vim and then saved the file with :wq - solved.

Edited: 1st April 2017 - :set ff=dos is for Windows style CR/LF .... 

No comments:

Post a Comment