#!/bin/bash now=`date +%d/%m/%Y` onedayago=`date --date="1 day ago" +%d/%m/%Y` twodayago=`date --date="2 day ago" +%d/%m/%Y` wget -O now.tmp -q "http://www.cbr.ru/scripts/XML_daily.asp?date_req=$now" wget -O onedayago.tmp -q "http://www.cbr.ru/scripts/XML_daily.asp?date_req=$onedayago" wget -O twodayago.tmp -q "http://www.cbr.ru/scripts/XML_daily.asp?date_req=$twodayago" nowk=`cat now.tmp | grep "USD" -A3 | sed -n -e 4p | tr -d "A-Za-z<>/\t'" | sed -es/\,/\./` onedayagok=`cat onedayago.tmp | grep "USD" -A3 | sed -n -e 4p | tr -d "A-Za-z<>/\t" | sed -es/\,/\./` twodayagok=`cat twodayago.tmp | grep "USD" -A3 |sed -n -e 4p | tr -d "A-Za-z<>/\t" ` dinamika=`echo $onedayagok-$nowk | bc` echo $dinamika
echo $nowk echo $onedayagok
echo $onedayagok-$nowk
? Add the output of this line with the command echo $onedayagok-$nowk
nowk=`cat now.tmp | grep "USD" -A3 | sed -n -e 4p | tr -d "A-Za-z<>/\t" | sed -es/\,/\./ >1.txt` onedayagok=`cat onedayago.tmp | grep "USD" -A3 | sed -n -e 4p | tr -d "A-Za-z<>/\t" | sed -es/\,/\./ >2.txt`
nowk=`cat 3.txt` onedayagok=`cat 4.txt`
nowk=`cat now.tmp | grep "USD" -A3 | sed -n -e 4p | tr -d "A-Za-z<>/\t'\r'" | sed -es/\,/\./` onedayagok=`cat onedayago.tmp | grep "USD" -A3 | sed -n -e 4p | tr -d "A-Za-z<>/\t'\r" | sed -es/\,/\./` twodayagok=`cat twodayago.tmp | grep "USD" -A3 |sed -n -e 4p | tr -d "A-Za-z<>/\t'\r'" ``
Source: https://habr.com/ru/post/254123/
All Articles