diff options
Diffstat (limited to '')
-rwxr-xr-x | .local/bin/status/sb-forecast | 18 |
1 files changed, 7 insertions, 11 deletions
diff --git a/.local/bin/status/sb-forecast b/.local/bin/status/sb-forecast index 08b788d..413a280 100755 --- a/.local/bin/status/sb-forecast +++ b/.local/bin/status/sb-forecast @@ -1,20 +1,16 @@ #!/bin/sh -weatherreport="/tmp/weatherreport" -weatherglyph="/tmp/weatherglyph" -moonglyph="/tmp/moonglyph" +# weatherreport="/tmp/weatherreport" +# weatherglyph="/tmp/weatherglyph" +# moonglyph="/tmp/moonglyph" -getweather() { - curl -sf "wttr.in/Lyon" >$weatherreport || (rm -f $weatherreport && exit 1) - curl -sf "wttr.in/Lyon?format=%c" >$weatherglyph || exit 1 - curl -sf "wttr.in/?format=%m" >$moonglyph || exit 1 -} - -[ -f $weatherreport ] && [ "$(gnustat -c %y "$weatherreport" 2>/dev/null | cut -d' ' -f1)" = "$(date '+%Y-%m-%d')" ] || getweather +weatherreport=$(curl -sf "wttr.in/Lyon" 2>&1 || exit 1) # >$weatherreport || (rm -f $weatherreport && exit 1) +weatherglyph=$(curl -sf "wttr.in/Lyon?format=%c" 2>&1 || exit 1) # >$weatherglyph || exit 1 +moonglyph=$(curl -sf "wttr.in/?format=%m" 2>&1 || exit 1) # >$moonglyph || exit 1 printf "%s%s" \ "$(cat $weatherglyph)" \ - "$(sed '16q;d' "$weatherreport" | grep -wo "[0-9]*%" | sort -rn | sed "s/^//g;1q" | tr -d '\n')" \ + "$(sed '16q;d' "$weatherreport" | grep -wo "[0-9]*%" | sort -rn | sed "s/^/ /g;1q" | tr -d '\n')" sed '13q;d' "$weatherreport" | grep -o "m\\([-+]\\)*[0-9]\\+" | sed 's/+//g' | sort -n -t 'm' -k 2n | sed -e 1b -e '$!d' | tr '\n|m' ' ' | |