From f709af2f052bb5cefd1f6be0aba0c876d4c830ef Mon Sep 17 00:00:00 2001 From: stkhan Date: Thu, 9 May 2024 18:23:30 +0000 Subject: shows what location you're in --- nws | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'nws') diff --git a/nws b/nws index c4c5d17..2e6febc 100755 --- a/nws +++ b/nws @@ -31,7 +31,10 @@ retrieve_counties() { get_location() { - cords=$(curl ipinfo.io/json | jq -r .loc) + file=$(curl ipinfo.io/json >> /tmp/nws/loc) + cords=$(jq -r '.loc' /tmp/nws/loc) + city=$(jq -r '.city' /tmp/nws/loc) + state=$(jq -r '.region' /tmp/nws/loc) } show_radar() { @@ -109,10 +112,14 @@ get_graphicast() { get_forecast() { colors + mkdir -p /tmp/nws/ get_location curl $(curl https://api.weather.gov/points/$cords | jq -r .properties.forecast) >> ~/.cache/.weather_forecast count=0 + echo length=$(echo $(jq '.properties.periods | length' ~/.cache/.weather_forecast) -1 | bc) + echo -e "Weather for ${GREEN}$city, $state${NOCOLOR}:" + echo while [ $count -le $length ] do echo ---------------------------------------------------------------------------------------------------- -- cgit v1.2.3