tl  tr
  Home | Tutorials | Articles | Videos | Products | Tools | Search
Open Source | Tag Cloud | Follow Us | Bookmark | Contact   
 
 How to Fix > Cygwin > Syntax error unexpected end of file

Syntax error unexpected end of file 

The following problem mainly occurs in Cygwin when you try to run a shell script which is edited or created in DOS/Windows or old Mac systems.

Problem

Syntax error : unexpected end of file

In DOS/Windows text files new line is a combination of two characters : a Carriage Return (\r) followed by Line Feed (\n) character. In Mac prior to Mac OS X, a line break was single Carriage Return (\r) character. Linux/Unix and Modern Mac OS uses Unix style Line Feed (\n) line breaks. Cygwin fails to process the scripts formatted in DOS/Windows or old Mac OS because of the extra Carriage Return (\r) character.

To solve the problem use dos2unix.exe command to convert the script to Unix readable format.

script3.PNG

conversion3.PNG


                    Print

   



Books Recommendation

 
 
bl  br