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.
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.