scripts

custom scripts and utils
git clone git://git.pyratebeard.net/scripts.git
Log | Files | Refs | README

commit fe8275f455d2fd0648b5aa075cce191c5e4b5fcb
parent 4d453f69e6d2c09b8210783b7cc6fc203e654b9e
Author: pyratebeard <root@pyratebeard.net>
Date:   Tue, 30 Jan 2024 11:32:38 +0000

use dns.toys

Diffstat:
Mbin/.local/bin/weather | 14+++-----------
1 file changed, 3 insertions(+), 11 deletions(-)

diff --git a/bin/.local/bin/weather b/bin/.local/bin/weather @@ -1,13 +1,5 @@ #!/bin/sh -weather() { - local -r location="$(curl -s "https://ipvigilante.com/" | jq -r '.data.city_name')" - wttr=$(curl -s "wttr.in/${location}?format=%l:+%f+%C\n" | tr '[:upper:]' '[:lower:]') - if [[ ${wttr} == "unknown location"* ]] ; then - echo -e "weather is ${light_red}unavailable${reset}" > /tmp/weather - else - echo -e "${wttr}" > /tmp/weather - fi -} - -weather +str="$(dig dublin/ie.weather +short @dns.toys | head -n1)" +eval arr=($str) +echo "${arr[1]}" "${arr[3]}"