## Number Comparison

These operators can be used to compare two numbers:

>= To compare whether one number is greater than or equal to the other number

<= To compare whether one number is less than or equal to the other number

> To compare whether one number is greater than the other number

< To compare whether one number is less than the other number

The next examples compare two numbers, numberi and number2, in a shell program called compare2:

#!/bin/tcsh set numberi=5 set number2=i0 set number3=5

if (\$numberi > \$number2) then echo "numberi is greater than number2" else echo "numberi is not greater than number2"

endif if (\$number1 >= \$number3) then echo "number1 is greater than or equal to number3" else echo "number1 is not greater than or equal to number3" endif if (\$number1 < \$number2) then echo "number1 is less than number2" else echo "number1 is not less than number2" endif if (\$number1 <= \$number3) then echo "number1 is less than or equal to number3" else echo "number1 is not less than or equal to number3" endif

When executing the shell program compare2, you get the following results:

numberl is not greater than number2 numberl is greater than or equal to number3 numberl is less than number2 numberl is less than or equal to number3