In bash scripts,
if [[ $var1 != $var2 ]]
is equivalent to the form
[ $var1 -ne $var2 ]
Why don't the relational operators (<=
, >=
) work inside the double test form? I tried [[ $var1 <= $var2 ]]
in one of my scripts and it gives me a syntax error. Must I use the form [[ $var1 < $var2 || $var1 = $var2 ]]
? Or is there something I'm missing?
You can use the
(( ))
construct:or: