if condition in shellscript

Hi All,

I tried below code

getting error.

AD=0
ZERO=0

 
if [ $AD == $ZERO ] then
echo "AD is zero select another symbol"
fi
syntax error near unexpected token `fi'

plz help me to solve this error

Numerical Comparator .. Go with -eq option instead of == And also ; is missing ..

if [ $AD -eq $ZERO ] ; then 
1 Like

Wrong syntax.
Try this:

if [ $AD -eq $ZERO ]
then
    echo "blah blah"
fi
1 Like
if [$AD  -eq $ZERO ] 
then
echo '$AD is zero select another symbol'
fi
1 Like

Thanks to all !!