have a problem with if elif loop .. plz help me with the script

count2=0
var2=NOT

if [ $count2 -eq 0 ]
then
echo"Loop1"
command="egrep ',$var1,"
if [ "$var2" = "OR" ]
then
echo "the command is OR"
command=$command"|,$var3,"
echo "$command"
elif [ "$var2 = "AND" ]
then
command=$command"| egrep ',$var3,"
else
echo "the command is NOT"
command=$command"| egrep -v ',$var3,"
echo "$command"
fi
else
echo "Loop2"
fi

I m getting the error 'end of file' unexpected and not able to proceed further.. Plz help me with this. Teh script and the syntax looks fine to me... But dunno where the mistake is
:confused:

In this statement:

command=$command"|,$var3,"

are you trying to append some text to the existing variable?

If that is the case, then use the following syntax to append a value to an existing variable:

NAME=$NAMEappend_value

same applies to these statements:
command=$command"| egrep ',$var3,"
command=$command"| egrep -v ',$var3,"

hi
tried using append command it does not work.. i m using korn shell.
And can u plx suggest a solution for if elif loop problem..?

change this:

elif [ "$var2 = "AND" ]

to this:

elif [ "$var2" = "AND" ]

thanks a lot...... Its working :slight_smile: