In below script I'm trying to match one column of a table value "True".If value is True then echo "Condition Satisfied" if not then "Condition not Satisfied" by using if and else statement this will be a expression condition checking the type value for 5 number of times.
#!/bin/bash
# set -xv
echo ' '
MessageDir=/hometype.out
ScriptName=Type_TEST
ScriptOutput=${MessageDir}/${ScriptName}.all.`date +"%y%m%d%H%M%S"`.msg
{
S3=TRUE
z=5
A=1
while [ $A -le $z ]
do
<DBconnection>
"SELECT TYPE FROM TEST_TYPE" > /hometype.out
m=`sed -n '3,$s/.*| \([^ ]*\) */\1/p' /hometype.out`
if [ $m == $S3 ];
echo "$m=$S3 "
echo "Condition Satisfied"
echo "$(m) --> current value"
rm /hometype.out
exit 12
else
echo ' '
echo `date`
echo "condition not satisfied"
sleep 120
A=`expr $A + 1`
} >> $ScriptOutput
fi
done
exit 12
but while running this script,I'm getting
test_type: line 23: syntax error near unexpected token `else'
test_type: line 23: `else'
Can any body Please tell what is the thing ..I'm missing here. Thanks in advance.