[download]

local/bin/weather

   1 #!/bin/bash
   2 
   3 f=~/.cache/weather
   4 
   5 (( $(date +%s) - $(date -r $f +%s) < 60 * 5 )) && cat $f && exit
   6 
   7 IFS=, read icon weather feels desc < <(
   8 curl -s 'https://wttr.in/spb?lang=ru&format=%c,%t,%f,%C')
   9 
  10 [[ ! $icon || $icon == Unknown* ]] && cat $f && exit
  11 
  12 echo $icon > $f.ico
  13 echo "$weather ${desc,,}, ощущается как $feels" | tee $f
  14 printf '<svg><text font-family="Emoji"
  15 y="30" font-size="32">%s</text></svg>' $icon > $f.svg