distribution/packages/jelos/sources/scripts/timeinfo
2022-02-05 09:23:32 -05:00

22 lines
529 B
Bash
Executable file

#!/bin/bash
# SPDX-License-Identifier: GPL-2.0-or-later
# Copyright (C) 2020-2022 Shanti Gilbert (https://github.com/shantigilbert)
# Copyright (C) 2022-present Fewtarius (https://github.com/fewtarius)
function get_timezone() {
readlink -f /etc/localtime | sed 's;/usr/share/zoneinfo/;;'
}
function list_timezones() {
cat /usr/share/zoneinfo/zone1970.tab | grep -v "^#" | awk '{ print $3"," }' | sort -u
}
case "${1}" in
"current_timezone")
get_timezone
;;
"timezones")
list_timezones
;;
esac