【发布时间】:2017-07-27 22:37:35
【问题描述】:
我的示例时区网站类似于 this,我如何在 bash 终端控制台中使用 curl 获取其当前时区?
【问题讨论】:
我的示例时区网站类似于 this,我如何在 bash 终端控制台中使用 curl 获取其当前时区?
【问题讨论】:
curl -sS https://www.timeanddate.com/time/zone/canada/toronto | grep -o '"/time/zones/[a-z]\+[^>]*>[^<]*' | head -n1 | grep -o '[^>]*$'
输出:EST
如果您需要网站的其他值,请根据您的需要调整正则表达式。
编辑:-sS
【讨论】:
/dev/null 或使用curl -sS
EST。再次感谢 Samuel Kirschner。