I'm on windows 7 using Cygwin.
My script and text file are located in the same directory.
#!/bin/bash
while read name; do
echo "Name read from file - $name"
done < /home/Matt/servers.txt
I get this error and I don't know why because this is correct while loop syntax..?
u0146121@U0146121-TPD-A ~/Matt
$ ./script.sh
./script.sh: line 4: syntax error near unexpected token `done'
./script.sh: line 4: `done < /home/Matt/servers.txt'
Can anybody tell me what I'm doing wrong? I think its because I'm on windows and using Cygwin.
/home/Matt/
. please note that your home would be underC:\cygwin\home\matt
. It is case sensitive when you access from cygwin.:set notextmode :wq
) and all works.flip -u script.sh
to remove CR LF