Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- Check(){
- wget -4q --tries=10 --timeout=20 --spider http://google.com
- [[ $? -eq 0 ]] && echo 1 || echo 0
- }
- Weather(){
- wget -4qO- https://p.ya.ru/$1 |\
- html2text -utf8 | head -4 |\
- sed '2d;s/Сегодня //g;s/[[:alpha:]]/\u&/;s/.˚C/ ˚C/' > ~/.weather/temp
- local str1=$(cat ~/.weather/temp | sed -n 1p)
- local str2=$(cat ~/.weather/temp | sed -n 2p)
- local str3=$(cat ~/.weather/temp | sed -n 3p)
- echo "$str1 $str2"
- echo "$str3"
- }
- sleep 3
- if [ "$(Check)" == 1 ]; then
- Weather 20
- Weather dubna
- else
- echo "No internet"
- fi%
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement