Writing Bash scripts on windows
When writing Bash scripts for cygwin on windows, most text editing software will add a DOS carriage return which when the bash script is run in cygwin will cause it to fail.
There seems to be two solutions
- Use dos2unix or similar to convert the .sh file to a proper unix version
- Use the following line of code at the top of your .sh file
(set -o igncr) 2>/dev/null && set -o igncr;
Useful ink: http://stackoverflow.com/questions/11616835/cygwin-r-command-not-found-bashrc-bash-profile
Updated less than a minute ago