Skip to content

Instantly share code, notes, and snippets.

@jasonrhodes
Last active January 10, 2022 23:13
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jasonrhodes/c649b679f2ac7ff176dd9c0b06fa5413 to your computer and use it in GitHub Desktop.
Save jasonrhodes/c649b679f2ac7ff176dd9c0b06fa5413 to your computer and use it in GitHub Desktop.
Manage your Mac OS X timezone like, super easy and stuff
#!/usr/bin/env bash
get() {
sudo systemsetup -gettimezone
}
set() {
sudo systemsetup -settimezone $1
}
list() {
sudo systemsetup -listtimezones
}
search() {
list | grep -i $1
}
printCurrentTime() {
echo "Current Time: $(node -p 'new Date().toString()')"
}
if [[ $1 == 'get' ]]; then
get
printCurrentTime
exit 0
fi
if [[ $1 == 'set' ]]; then
set $2
printCurrentTime
exit 0
fi
if [[ $1 == 'list' ]]; then
list
exit 0
fi
if [[ $1 == 'search' ]]; then
search $2
exit 0
fi
echo """
Usage:
timezone get get current timezone
timezone set TIMEZONE sets current timezone to valid TIMEZONE
timezone list lists valid timezone strings
timezone search SUBSTRING searches valid timezones for given SUBSTRING
"""
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment