Forked from thatisuday/bash-comparison-operators.csv
Created
October 4, 2020 20:10
-
-
Save ephraimduncan/c8cf4bc1d9c551c755635123d93b0f82 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