Syntax
Bash Compare Numbers Syntax
In Bash, compare numbers: numeric test operators — -eq -ne -lt -le -gt -ge
Quick Answer
- Syntax
-eq -ne -lt -le -gt -ge
BashSyntax
Compare Numbers
Code example
-eq -ne -lt -le -gt -ge
Numeric test operators.
How to compare numbers in Bash
- Open your Bash file or editor.
- Copy the example, then replace its sample names and values for your code.
Bash Compare Numbers Syntax
Use -eq -ne -lt -le -gt -ge.
Related Syntax References
Frequently asked questions
What is the Bash syntax for compare numbers?
Use this pattern: -eq -ne -lt -le -gt -ge
Can I copy this Bash code example?
Yes. Use Copy code and adapt the example to your program.
Is this Bash syntax different on Mac or Windows?
No. The language syntax is the same across operating systems.
Official source · How we verify