Last active
October 4, 2020 20:10
-
-
Save thatisuday/d160535f07cea34e949da5a89015fe8a to your computer and use it in GitHub Desktop.
Comparison Operators in Bash
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Operator | Purpose | For DataType | |
---|---|---|---|
= | Equal to operation | string | |
== | Equal to operation | string | |
!= | is not equal to | string | |
< | is less than in ASCII alphabetical order | string | |
> | is greater than in ASCII alphabetical order | string | |
-z | if a string is empty (or null) | string | |
-n | if a string is not empty (or not null) | string | |
-eq | is equal to | number | |
-ne | is not equal to | number | |
-lt | is less than | number | |
-le | is less than or equal to | number | |
-gt | is greater than | number | |
-ge | is greater than or equal to | number |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
More operators listed on: https://blog.100tb.com/scripting-if-comparison-operators-in-bash