himvat
1
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'
himvat
3
actually i am using cygwin ,,,u can ignore that
don't understand what's implied, but ok....
Can you post the entire code snippet?
himvat
5
#!/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
Ikon
6
I dont see any problems. Works on my CentOs and Cygwin.
himvat
7
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'.
himvat
9
./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!