You could add automatic retrival of timezone base on IP location. I use jq to parse the JSON, but you could use grep -Po '"timezone": "\K[^"]*' <<< "$IP_INFO", too.
setTimeZone(){
# Get location-based timezone
IP_INFO="$(curl -s https://ipinfo.io)"
IP_TZ="$(jq -r .timezone 2>/dev/null <<< "$IP_INFO")"
# Set time zone
read -p "Enter the time zone [$IP_TZ]: " time_zone
if [ ! "$timezone" ]; then
time_zone="$IP_TZ"
fi
}
You could add automatic retrival of timezone base on IP location. I use
jqto parse the JSON, but you could usegrep -Po '"timezone": "\K[^"]*' <<< "$IP_INFO", too.