SHELL Script IF Condition Statements

 

if..else..fi

echo "Enter the Two Values:"
Read a b
if [ $a -eq $b ]
then
echo " a is equal to b"
else
echo " a is not equal to b"
fi

if..elif..else..fi

echo "Enter the three values:"
read a b c
if [ $a -gt $b -o $a -gt $c ]; then
echo "$a is Big"
elif [ $b -gt $c ]; then
echo "$b is Big"
else
echo "$c is Big"
fi

Comments