0

I downloaded a dna.sh off of Github, and I can't seem to get it to work on cygwin. When I use the command,

sh dna.sh

, I get the error,

 : No such file or directory
dna.sh: line 7: $'\r': command not found 
dan.sh: line 9: syntax error near unexpected token `$'do\r' '
'na.sh: line 9: `for j in f b; do

The contents of the dna.sh are here: https://github.com/jaykru/colorscripts/blob/master/dna.sh

1 Answers1

2

Did you write your file in Windows and now are executing it in Cygwin? Please, don't tell me you used Notepad.exe.

dope slap!

Your problem is that Windows puts a Carriage Return and a Line Feed character at the end of each line \r\n. However, Unix (and Cygwin) insist that the correct line ending combination is a mere Linefeed \n.

Use a real program editor to write your programs. Don't use Notepad. Download Notepad++ and set it to use LF (Unix line endings) on all your shell scripts. Or, learn to edit your files in Cygwin. You can use VIM or gmacs (gmacs is a great operating system. Too bad there's no editor with it. //old Editor war joke//).

Actually, there are a variety of GUI editors on Cygwin too, but you have to get X11 working.

You can try dos2unix on Cygwin -- if you've installed it.

David W.
  • 105,218
  • 39
  • 216
  • 337