Linux获取天气的方式主要还是使用curl的方式,通过HTTP去获取天网站的信息,比如写个脚本:
#!/bin/sh weatherDateRoot=http://www.weather.com.cn/data/sk/101190101.html weatherDataFile=weather.html curl $weatherDateRoot -o $weatherDataFile > /dev/null 2>&1或者通过最简单的命令:
curl wttr.in -o weather.text可以到文件内查看天气信息:
![linux 获取天气信息 linux 获取天气信息](https://cms-pic.yhzz.com.cn/1683928365436.jpg)