Here is the script -> https://github.com/CarloBarraco/getweather
The output would be something like
Code: Select all
Overcast clouds|Temp:-4.681C|Wind:11.736kph
Code: Select all
Overcast clouds|Temp:23.5742F|Wind:18.88721424mph
So I wrote this little script to neaten it up a bit. Edit: version 2 with added weather types, eg, rain, snow
Also note the name of the script is getweather. I named it weather locally.
Code: Select all
#! /bin/bash
## script is from https://github.com/CarloBarraco/getweather
## I wrote this to clean up the output
## change location as needed
## weather icons are from lemon fonts
## 2015 dkeg
## get the weather and format nicely
## use an underscore with 2 word cities (New_York_City)
loc='where do you live?'
sky=$(weather -l $loc -d)
temp=$(weather -l $loc -t -i|cut -d ':' -f2|cut -d '.' -f1)"F"
wind=$(weather -l $loc -w -i |cut -d ':' -f2|cut -d '.' -f1)"mph"
sep=" "
case $sky in
"Sky is clear")
glyph="⯇ " ;;
"Overcast clouds")
glyph="⯄ " ;;
"Light rain")
glyph="⮿ " ;;
"Moderate rain")
glyph="⯃ " ;;
"Light snow")
glyph="⯁ " ;;
"Snow")
glyph="⯁ " ;;
esac
echo $glyph $sky$sep $temp$sep⯈ $wind
## Disclaimer: typical stuff. I'm no expert. I wrote this to solve my own issue. It works for me. It may prove useful to you. If so great. If not; bye. Please use it as needed or as a foundation for something better