When using bash scripts under Windows (cygwin terminal in my case): I often got “syntax error near unexpected token `$’do\r” ” or in my language: “syntaxfout nabij onverwacht symbool ‘$’do\r””

No worries just execute the dos2unix command on the script and 99% chance the issues is solved.