mirror of
https://github.com/alexanderepstein/Bash-Snippets
synced 2018-11-08 02:59:35 +01:00
Fixing weather grabbing initials for states with two words
This commit is contained in:
parent
aec1a885ae
commit
98c6210d06
1 changed files with 5 additions and 1 deletions
|
@ -40,7 +40,11 @@ getIPWeather()
|
|||
if [[ $country == "US" ]]; then ## if were in the us id rather not use longitude and latitude so the output is nicer
|
||||
city=$(httpGet ipinfo.io/city) > /dev/null
|
||||
region=$(httpGet ipinfo.io/region) > /dev/null
|
||||
if [[ $(echo $region | wc -w) == 2 ]];then
|
||||
region=$(echo $region | grep -Eo "[A-Z]*" | tr -d "[:space:]")
|
||||
else
|
||||
region=$(echo "$region" | cut -c "1-2" | tr "[:lower:]" "[:upper:]")
|
||||
fi
|
||||
httpGet $locale.wttr.in/$city,$region$1
|
||||
else ## otherwise we are going to use longitude and latitude
|
||||
location=$(httpGet ipinfo.io/loc) > /dev/null
|
||||
|
|
Loading…
Reference in a new issue