shell script to find largest and smallest of three numbers

shell script


echo “enter 3 numbers”
read a b c
if (( $a > $b  && $a > $c ))
then
echo “$a is maximum number”
elif (( $b > $a  && $b > $c ))
then
echo “$b is maximum number”
elif (( $c > $a  && $c > $b ))
then
echo “$c is maximum number”
fi


output:-

$ bash max.sh
enter 3 numbers
12 23 11
23 is maximum number

Post a Comment

If you have any doubts, Please let me know
Thanks!

Previous Post Next Post