simple shell script in cygwin

cygwin, shell, unix

Solution

Run dos2unix on your shell script. That will fix the problem.

Problem

``` #!/bin/bash echo 'first line' >foo.xml echo 'second line' >>foo.xml ``` I am a total newbie to shell scripting. I am trying to run the above script in cygwin. I want to be able to write one line after the other to a new file. However, when I execute the above script, I see the follwoing contents in foo.xml: ``` second line ``` The second time I run the script, I see in foo.xml: ``` second line second line ``` and so on. Also, I see the following error displayed at the command prompt after running the script: ``` : No such file or directory.xml ``` I will eventually be running this script on a unix box, I am just trying to develop it using cygwin. So I would appreciate it if you could point out if it is a cygwin oddity and if so, should I avoid trying to use cygwin for development of such scripts? Thanks in advance.

Original source