Comparing Numbers
Use -eq -ne -lt -le -gt -ge inside [[ ]] or the operators inside (( )).
Example
a=5; b=9
[[ $a -lt $b ]] && echo "a<b"
(( a == 5 )) && echo "a is 5"
(( a > b )) || echo "a not bigger"Result
a<b a is 5 a not bigger
Exercise
Greater than.
[[ 3 2 ]]
Quiz Test
These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.