distribution/packages/jelos/sources/scripts/timeinfo

22 lines
525 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) 2023 JELOS (https://github.com/JustEnoughLinuxOS)
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