Numeric comparison
From Linux Shell Scripting Tutorial - A Beginner's handbook
The test command can perform various numeric comparison using the following operators:
| Operator | Syntax | Description | Example |
|---|---|---|---|
| eq | INTEGER1 -eq INTEGER2 | INTEGER1 is equal to INTEGER2 | #!/bin/bash |
| ge | INTEGER1 -ge INTEGER2 | INTEGER1 is greater than or equal to INTEGER2 | #!/bin/bash |
| gt | INTEGER1 -gt INTEGER2 | INTEGER1 is greater than INTEGER2 | #!/bin/bash |
| le | INTEGER1 -le INTEGER2 | INTEGER1 is less than or equal to INTEGER2 | #!/bin/bash |
| lt | INTEGER1 -lt INTEGER2 | INTEGER1 is less than INTEGER2 | #!/bin/bash |
| ne | INTEGER1 -ne INTEGER2 | INTEGER1 is not equal to INTEGER2 | #!/bin/bash |