Bash operators
From wikinotes
'[...]' vs '[[...]]'
This is kind of frustrating, especially when starting out.
There are two types of expressions in bash, and each uses different operators.
[ 123 -eq 123 ] # equal [ 123 -ne 321 ] # not equal [ 1 -le 2 ] # less than or equal [ 1 -lt 2 ] # less than [ 2 -ge 1 ] # greater than or equal [ 2 -gt 1 ] # greater thanSee
man test
.[[ "123" == "123" ]] # equal [[ "123" != "321" ]] # not equal [[ "ab" <= "abc" ]] # less characters or equal [[ "ab" < "abc" ]] # less characters [[ "abc" >= "ab" ]] # more characters or equal [[ "abc" > "ab" ]] # more characters