-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Description
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
}Metadata
Metadata
Assignees
Labels
No labels