dotfiles/.local/bin/statusbar/corona

12 lines
704 B
Plaintext
Raw Normal View History

2020-07-04 14:23:27 +02:00
#!/bin/bash
( [ "$(stat -c %y ~/.cache/corona | cut -d' ' -f1)" != "$(date '+%Y-%m-%d')" ] || [ "$1" = "up" ] )&&
curl -s https://corona-stats.online/Switzerland | sed -r "s/[[:cntrl:]]\[[0-9]{1,3}m//g" > ~/.cache/corona && notify-send "Corona" "Stats updated"; sleep 5; pkill -RTMIN+15 dwmblocks
increase=$( grep "Switzerland" ~/.cache/corona |
sed "s/\s*//g; s/║//g; s/│/;/g" | awk -F';' '{print $4}' )
[ "$increase" != "" ] && ( grep "Switzerland" ~/.cache/corona |
sed "s/\s*//g; s/║//g; s/│/;/g" |
awk -F';' '{print "😷"$3 " ("$4") 💀"$5 }' ) || ( grep "Switzerland" ~/.cache/corona |
sed "s/\s*//g; s/║//g; s/│/;/g" |
awk -F';' '{print "😷"$3 " 💀"$5 }' )