Open DhillanC opened 3 months ago
Corrected shell script:
today=$(date +%Y%m%d) weather_report=rawdata$today
city=Casablanca curl wttr.in/$city --output $weather_report
grep °C $weather_report > temperatures.txt
obs_tmp=$(head -1 temperatures.txt | tr -s " " | xargs | rev | cut -d " " -f2 | rev)
fc_temp=$(head -3 temperatures.txt | tail -1 | tr -s " " | xargs | cut -d "C" -f2 | rev | cut -d " " -f2 | rev)
hour=$(TZ='Morocco/Casablanca' date -u +%H) day=$(TZ='Morocco/Casablanca' date -u +%d) month=$(TZ='Morocco/Casablanca' date +%m) year=$(TZ='Morocco/Casablanca' date +%Y)
record=$(echo -e "$year\t$month\t$day\t$hour\t$obs_tmp\t$fc_temp") echo $record>>rx_poc.log
As a User I need To get the weather report So that I modify the plans
Details and Assumptions
Extract from a possible linux script:
!/bin/bash
Assign today's weather filename
today=$(date +%Y%m%d) weather_report=rawdata$today
Download today's weather raw data
city=Casablanca curl wttr.in/$city --output $weather_report
Save today's temperature
grep °C $weather_report > temperatures.txt obs_tmp=$(head -1 temperatures.txt | tr -s " " | xargs | rev | cut -d " " -f2 | rev)
Save tomorrow's temperature
fc_temp=$(head -3 temperatures.txt | tail -1 | tr -s " " | xargs | cut -d "C" -f2 | rev | cut -d " " -f2 | rev)
Store current date to variables for future validation
TZ='Africa/Casablanca'
hour=$(TZ='Morocco/Casablanca' date -u +%H) day=$(TZ='Morocco/Casablanca' date -u +%d) month=$(TZ='Morocco/Casablanca' date +%m) year=$(TZ='Morocco/Casablanca' date +%Y)
Append the fields of the execution time with the observed temperature
record=$(echo -e "$year\t$month\t$day\t$hour\t$obs_tmp\t$fc_temp") echo $record>>rx_poc.log
Acceptance Criteria