Alternative form

Control flow / Conditional statements / if/else statements

RANDOM=42
latitude=$(( RANDOM % 181 - 90 ))
#latitude is from -90 to 90

#the whole if in one line: ; stands for the line breaks
if (( latitude == 0 )); then location="Equator"; else \
    location="not at the Equator"; fi

#&& runs the next command if the condition is true, || if it is false
(( latitude < 0 )) && hemisphere="Southern" || hemisphere="Northern"

#the old form: [ ] is the command test, numbers are compared by -ge;
#[[ ]] is newer and safer, it is the one to use in bash
if [ "$latitude" -ge 0 ]; then sign="+"; else sign="-"; fi

echo "latitude is $latitude"
echo "location is $location"
echo "hemisphere is $hemisphere"
echo "sign is $sign"