Bash script calculate GREATEST AMONG THREE NUMBERS shell program

Linux and UNIX shell program using –gt command it will find the greatest between the two numbers. Using if and elseif condition with using logical And OR operation. In the shell program it will find the biggest among the three numbers.
Source code bash shell Programming Algorithm
echo " Enter A value: "
read a
echo " Enter B value: "
read b
echo " Enter C value: "
read c
if [ $a -gt $b ] && [ $a -gt $c ]
then
echo "A value is greater"
elif [ $b -gt $a ] && [ $b -gt $c ]
then
echo "B value is greatest "
else
echo "C value is greatest "
fi

OUTPUT GREATEST AMONG THREE NUMBERS CS1252 Operating Systems lap
[redhat35@localhost Rhel5]$ sh greatest.sh
Enter A value:
5
Enter B value:
6
Enter C value:
2
Bvalue is greatest

Related post