LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   Syntax error (https://www.linuxquestions.org/questions/programming-9/syntax-error-322018/)

phernand 05-10-2005 12:01 PM

Syntax error
 
I keep getting this syntax error when i try running one of my scripts.

##Test2
>temp$$
set `cat data19`
for i in `echo $*`
do
echo $i>>temp$$
done

cnt=0
for k in `cat temp$$|grep -i junk`
do
cnt=`expr $cnt + 1`
if[`expr $cnt %2` -eq 0]
then
echo $k
fi
done
echo $cnt
rm -f temp$$


The syntax error reads
smoke1: line 14: syntax error near unexpected token `then'
smoke1: line 14: ` then'

I have no clue what this error means

can anybody help?

pnellesen 05-10-2005 12:04 PM

Pure wild-a** guess here: Do you need a space between the "if" and the open square bracket? So the line would instead be "if [ blah ]..."

Or possibly the "then" keyword isn't recognized by that particular script processor? so maybe take the "then" keyword out and try it?


All times are GMT -5. The time now is 10:06 AM.