#RANDOM=42 设置种子,因此每次运行结果相同
RANDOM=42
latitude=$(( RANDOM % 181 - 90 ))
#latitude 在 -90 到 90 之间
#(( )) 比较数字;[[ ]] 比较字符串,
#比较数字时需要 -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"