Skip to content

Instantly share code, notes, and snippets.

@thatisuday
Last active October 4, 2020 20:10
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save thatisuday/d160535f07cea34e949da5a89015fe8a to your computer and use it in GitHub Desktop.
Save thatisuday/d160535f07cea34e949da5a89015fe8a to your computer and use it in GitHub Desktop.
Comparison Operators in Bash
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
@thatisuday
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment