You are not logged in.
Pages: 1
Hello everybody,
I have this script that shows diff time zones
cat /usr/local/bin/tz
#!/bin/sh
#
# alias tz='/usr/local/tz'
#
# Access available time zones in /usr/share/zoneinfo
TIME_ZONES="Europe/GMT US/Eastern US/Central US/Pacific"
OUTPUT=""
for loc in $TIME_ZONES; do
CITY=`echo $loc | sed 's/\// /g' | awk '{ print $2 }'`
CUR_TIME=`TZ=${loc} date | awk '{ print $2 " " $3 " " $5 " " $6 }'`
TEMP=`awk -v l="$CITY" -v t="$CUR_TIME" 'BEGIN { print l "\t" t }'`
OUTPUT="${OUTPUT}\n${TEMP}"
done
echo -e $OUTPUT | column -t | tr '_' ' ' Two days ago it stopped working.
What might be causing that and how to solve it.
Any suggestions are appreciated.
Thank you in advance!
p.s. I did not write the script. Got it from somewhere and modified it because initially it was not working.
Last edited by amaro (2020-08-24 06:11:39)
Offline
Two days ago it stopped working.
Define "stopped working".
Are you familiar with our Forum Rules, and How To Ask Questions The Smart Way?
BlueHackers // fscanary // resticctl
Offline
Sorry about that
Thought I posted the output
Here it is
GMT Aug 24 AM Europe
Eastern Aug 24 AM EDT
Central Aug 23 PM CDT
Pacific Aug 23 PM PDTLast edited by amaro (2020-08-24 04:29:30)
Offline
Quick, before Trilby wakes up to a cardiac arrest… ;-)
#!/bin/bash
#
# alias tz='/usr/local/tz'
#
# Access available time zones in /usr/share/zoneinfo
export LC_ALL=C # AC/PM locale. Stupid Americans. The day has 24 fucking hours. Ask your army. Knuckleheads.
TIME_ZONES="Europe/GMT US/Eastern US/Central US/Pacific"
for loc in $TIME_ZONES; do
printf "${loc##*/} "
TZ=${loc} date '+%b %e %I:%M %P %Z' # check date --help for more format options
done | column -tOffline
@seth
Works fine
Looks better
Thank you, seth!
p.s. Deleted the comments. Hope you don't mind.
Last edited by amaro (2020-08-24 06:15:44)
Offline
Why would I?
Still true, though ... ;-P
(I just got briefly angry, because the script didn't work and there was no good reason - then I figured that the locale for am/pm was that this nonsense doesn't exist here ;-)
Offline
Pages: 1