## With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

No credit card required

### 17.4. Testing numbers

To test for numbers a different sort of operators are at our disposal. The general format is:

"number" numeric_operator "number"

or

[ "number" numeric_operator "number" ]

where the numeric_operator can be:

 -eq The two numbers are equal -ne The two numbers are not equal -gt The first number is greater than the second number -lt The first number is less than the second number -le The first number is less than or equal to the second number -gt The first number is greater than or equal to the second number

Both the following examples returns the same result. To test if a number is equal to another number (in this case is 130 equal to 130):

```						\$ NUMBER=130
\$ [ "\$NUMBER" -eq "130" ]
\$ echo \$?
0
```

Phew! I’m glad that one returned ...

## With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

No credit card required