Shell Script:
ch=1
while [ $ch -eq 1 ]
do
echo "Enter First number: "
read a
echo "Enter Second number: "
read b
echo "Enter third number: "
read c
if [ $a -eq $b -a $b -eq $c -o $a -eq $b -o $b -eq $c -o $c -eq $a ];
then
echo "please enter 3 different values"
ch=1
elif [ $a -gt $b -a $a -gt $c ];
then
echo "$a is greatest number"
ch=0
elif [ $b -gt $a -a $b -gt $c ];
then
echo "$b is greatest number"
ch=0
else
echo "$c is greatest number"
ch=0
fi
done
Output:
All three values are Different | Two values are same | |
---|---|---|
Tags:
Shell Script