shell script code to find greater no


echo "Enter first num"
read n1
echo "Enter the second num"
read n2
echo "Enter the third num"
read n3
if [ $n1 -gt $n2 ]
then
val=$n1
else
val=$n2
fi
if [ $val -gt $n3 ]
then
echo "$val is the greatest num"
else
echo "$n3 is the greatest num"
fi

/* OUTPUT

shell:~> ./greater_no
Enter first num
2
Enter the second num
4
Enter the third num
54
54 is the greatest num
*/

0 comments :