unexpected syntax error

Hi,

i am getting following syntax error ...kingly advice why is it coming ??


#!/bin/bash
find . -name "common.log"
if [ $? -eq 0 ]; then
echo "1"
fi
Himnashu@home /bin
$ ./a.sh
./a.sh: line 7: syntax error near unexpected token `fi'
./a.sh: line 7: `fi'

what is stuff in red?

actually i am using cygwin ,,,u can ignore that

don't understand what's implied, but ok....
Can you post the entire code snippet?

#!/bin/bash
find . -name "common.log"
if [ $? -eq 0 ]; then
echo "1"
else
echo "0"
fi

$ ./a.sh
./a.sh: line 9: syntax error: unexpected end of file

I dont see any problems. Works on my CentOs and Cygwin.

why is it showing unexpected error ?? dont know

there're 7 lines in this script and it complains about line 9.
Make sure you don't have any 'crumb' characters after the trailing 'fi'.


 ./b.sh
/b.sh: line 7: syntax error near unexpected token `fi'
/b.sh: line 7: `fi'

now it is showing this error

do you have control characters in your file?
do 'cat -vet b.sh' and post the output, pls!