Header Ads

Shell Script : 02 - To Determine the Greatest of 2 Number's

This Shell Script program determines the Greatest of the given 2 Number's. 

Logic: With a Simple 'If' condition.

Program Code:

#!/bin/bash
#Demonstration of if Condition

echo "Enter the Value of A : "
read a
echo "Enter the Value of B : "
read b

if [ $a -gt $b ]
then
 echo "A is greater than B"
else
 echo "B is greater than A"
fi

Program Output:

No comments