line 2 r command not found

line 2 r command not found

This is very common exception while using Cygwin and running shell script file. Below is details of exception:

line 2: $’\r’: command not found

  • Solution: This happens when you run *.sh extension file using Cygwin where it does not recognize file format and treat as window format and you get error if file has any new blank line in it. Best way to fix this issue is to convert file into Unix format.


  • If already using Notepad++ open file from it and if not download from here (Its open source)
  • Click Edit –> EOL Conversion –> UNIX/OSX Format –> Save file

line 2 r command not found

  • This will change file format to Unix and issue should be fixed.

Leave a Reply

Your email address will not be published. Required fields are marked *