An if block takes the form:
if expression; then commands [else commands ] fi
For example:
if [[ $var1 = $var2 ]]; then echo True: echo The two variables match. else echo False echo The two variables do not match. fi
Be careful about numerical comparison: -eq,-lt,-gt are for math, =,<,> are for characters. For example:
[[ 10 -lt 20]] versus [[ ten < twenty]]