标准写法

控制流 / 条件语句 / if/else 语句

#RANDOM=42 sets the seed, so the run repeats
RANDOM=42
latitude=$(( RANDOM % 181 - 90 ))
#latitude is from -90 to 90

#(( )) compares numbers; [[ ]] compares strings,
#for numbers it needs -eq, -lt, -gt
if (( latitude == 0 )); then
    location="Equator"
elif (( latitude < 0 )); then
    location="Southern Hemisphere"
else
    location="Northern Hemisphere"
fi

echo "latitude is $latitude"
echo "location is $location"