SHELL SCRIPT TO FIND BIGGEST OF THREE NUMBERS | URDINESH

Software Programming, Tutorials, Interview Preparations,Stock Market,BSE/NSE, General informations

Sunday, July 19, 2015

SHELL SCRIPT TO FIND BIGGEST OF THREE NUMBERS

BIGGEST OF THREE NUMBERS:

if [ $# -eq 3 ]
then
echo "All the no.'s are entered"
if [ $1 -gt $2 -a $1 -gt $3 ]
then
echo "The First Number is Greater " $1
else
if [ $2 -gt $3 ]
then
echo "The 2nd Number is Greater " $2
else
echo "The 3rd Number is Greater " $3
fi
fi
else
echo "Enter three numbers Again"
fi



















OUTPUT:

[localhost ~]$ sh big.sh 24  89 -22
All the no.'s are entered
The 2nd Number is Greater  89
[localhost ~]$

No comments:

Post a Comment

Thanks for your valuable comments

Followers