# 13. Number Comparison

• ### 13. Number Comparison

Write a script that takes two numbers as input and checks if the first number is greater than, less than, or equal to the second number.
• #!/bin/bash

read -p "Enter the 1st number: " num1
read -p "Enter the 2nd number: " num2
if [ \$num1 -eq \$num2 ]
then
echo "The numbers are equal"
else
echo "The number are not equal"
fi

• #!/bin/bash

read -p "Enter FIRST NUMBER " NUM1
read -p "Enter second  NUMBER " NUM2
if [ \$NUM1 -gt \$NUM2 ]
then
echo "\$NUM1 is greter than \$NUM2 "
elif [ \$NUM1 -eq \$NUM2 ]
then
echo "\$NUM1 is equeal to \$NUM2 "
else

echo "\$NUM2 is greter then \$NUM1 "
fi

• #! /bin/bash

read -p "Enter first number: " no1
read -p "Enter second number: " no2

if [ \$no1 -gt \$no2 ]
then
echo "\$no1 is greater than \$no2."
elif [ \$no1 -lt \$no2 ]
then
echo "\$no1 is less than \$no2."
else
echo "The numbers are equal."
fi

• #!/bin/bash

read -p "Enter the first number: " num1
read -p "Enter the second number: " num2

if [ \$num1 -gt \$num2 ]
then
echo "\$num1 is greater than \$num2."

elif [ \$num1 -lt \$num2 ]
then
echo "\$num1 is lesser than \$num2."
else
echo "\$num1 is equal to \$num2."
fi

exit 0