mirror of
https://github.com/alexanderepstein/Bash-Snippets
synced 2018-11-08 02:59:35 +01:00
Allowing calling ip weather with imperial or metric
This commit is contained in:
parent
23b6f98c7d
commit
3d2540b42a
@ -11,10 +11,10 @@ getIPWeather()
|
|||||||
city=$(curl -s ipinfo.io/city) > /dev/null
|
city=$(curl -s ipinfo.io/city) > /dev/null
|
||||||
region=$(curl -s ipinfo.io/region) > /dev/null
|
region=$(curl -s ipinfo.io/region) > /dev/null
|
||||||
region=$(echo "$region" | tr -dc '[:upper:]')
|
region=$(echo "$region" | tr -dc '[:upper:]')
|
||||||
curl $locale.wttr.in/$city,$region
|
curl $locale.wttr.in/$city,$region$1
|
||||||
else ## otherwise we are going to use longitude and latitude
|
else ## otherwise we are going to use longitude and latitude
|
||||||
location=$(curl -s ipinfo.io/loc) > /dev/null
|
location=$(curl -s ipinfo.io/loc) > /dev/null
|
||||||
curl $locale.wttr.in/$location
|
curl $locale.wttr.in/$location$1
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -108,6 +108,10 @@ if [[ $# == "0" ]]; then
|
|||||||
getIPWeather
|
getIPWeather
|
||||||
elif [[ $1 == "update" ]]; then
|
elif [[ $1 == "update" ]]; then
|
||||||
update
|
update
|
||||||
|
elif [[ $1 == "m" ]]; then
|
||||||
|
getIPWeather "?m"
|
||||||
|
elif [[ $1 == "i" ]]; then
|
||||||
|
getIPWeather "?u"
|
||||||
else
|
else
|
||||||
getLocationWeather $1 $2 $3 $4
|
getLocationWeather $1 $2 $3 $4
|
||||||
fi
|
fi
|
||||||
|
Loading…
Reference in New Issue
Block a user