Linux Bash/Shell查询多个时区的世界时

stevehe 2021年08月02日 260次浏览
#!/bin/sh
# Code From:https://stackoverflow.com/questions/370075/command-line-world-clock
# More Clock:https://www.timeanddate.com/worldclock/

CN=`env TZ=Asia/Shanghai date`
JP=`env TZ=Asia/Tokyo date`
MY=`env TZ=Asia/Yangon date`
SP=`env TZ=Singapore date`
PH=`env TZ=Asia/Manila date`
MS=`env TZ=Europe/Moscow date`
GM=`env TZ=GMT date`
UT=`env TZ=UTC date`
NY=`env TZ=America/New_York date`
LO=`env TZ=America/Los_Angeles date`
PT=`env TZ=US/Pacific date`
CT=`env TZ=US/Central date`
AT=`env TZ=Australia/Melbourne date`

echo "北京时间       $CN"
echo "东京时间       $JP"
echo "缅甸时间       $MY"
echo "新加坡时间     $SP"
echo "菲律宾时间     $PH"
echo "莫斯科时间     $MS"
echo "GMT Time       $GM"
echo "UTC Time       $UT"
echo "New York       $NY"
echo "Los_Angeles    $LO"
echo "Santa Clara    $PT"
echo "Central        $CT"
echo "Melbourne      $AT"

image.png