sh or bash
git clone https://github.com/hhchung/tools-weather_report.git
chmod a+x tools-weather_report/weather.sh
cd tools-weather_report
./weather [-h] [-l location] [-u unit] [-a|-c|-d day|-s]
- -h print help
- -l set locations
- -u set unit
- -a all information(equal -c -d 5 -s)
- -c current condition
- -d forecast
- -s sunrise/sunset
Configuration File(~/.weather.conf) for default setting
File position:
- ~/.weather.conf
Content:
- location
- unit( c or f)
ex:
location=hsinchu
unit=c
./weather.sh -l hsinchu -c
Taichung City, Mostly Cloudy, 57 Fahrenheit degree
./weather.sh -l hsinchu -u c -c
Taichung City, Mostly Cloudy, 14 Celsius degree
./weather.sh -l hsinchu,taipei,tainan -u c -c
Hsinchu City, Showers Late, 16 Celsius degree
Taipei City, Showers Late, 18 Celsius degree
Tainan City, Showers Late, 18 Celsius degree
./weather.sh -l taipei -d 4
Forecast: Taipei City
27 Jan 2016 Wed 61 ~ 74 Fahrenheit degree Showers Late
28 Jan 2016 Thu 62 ~ 71 Fahrenheit degree Light Rain
29 Jan 2016 Fri 60 ~ 68 Fahrenheit degree Rain
30 Jan 2016 Sat 56 ~ 63 Fahrenheit degree Rain
./weather.sh -l taipei -a
Taipei City, Showers Late, 64 Fahrenheit degree
27 Jan 2016 Wed 61 ~ 74 Fahrenheit degree Showers Late
28 Jan 2016 Thu 62 ~ 71 Fahrenheit degree Light Rain
29 Jan 2016 Fri 60 ~ 68 Fahrenheit degree Rain
30 Jan 2016 Sat 56 ~ 63 Fahrenheit degree Rain
31 Jan 2016 Sun 55 ~ 62 Fahrenheit degree Showers
sunrise: 6:37 am, sunset: 5:34 pm
- Using input string to get
woeid
- Using
woeid
to get country weather- Reference