Microsoft – Windows / Cygwin – Error – $’\r’: command not found

Background

In Microsoft Windows, Launched Cygwin terminal mode and running a little bash shell script.

But, getting the error “$’\r’: command not found”

The \r is a dead giveaway, as it means there is something amiss with Line Character and Carriage Return.

Fix

To fix:

  • Launched Notepad++
  • Load the Bash Script File
  • Access the menu items “Edit\EOL Conversion\Unix Format”
  • Re-save file (File \ Save)

Addendum

Addendum – Thursday July 10th, 2014

Please try the following StackOverflow Q/A postings:

  • Running shell script through cygwin on Windows
    Link
  • Replace lf with crlf in text file cygwin
    Link

They discuss using dos2unix to accomplish same thing.  Crediting Roman Hocke and “me_and“.

9 thoughts on “Microsoft – Windows / Cygwin – Error – $’\r’: command not found

Leave a comment