Zaktualizuj 'weather.sh'
This commit is contained in:
parent
2f5181237f
commit
402148c407
47
weather.sh
47
weather.sh
@ -10,8 +10,12 @@ do
|
|||||||
l) LOCATION="$OPTARG";;
|
l) LOCATION="$OPTARG";;
|
||||||
d) DYNAMIC=true;;
|
d) DYNAMIC=true;;
|
||||||
f) FAHRENHEIT=true;;
|
f) FAHRENHEIT=true;;
|
||||||
?) echo "Niepoprawna opcja: -$OPTARG"
|
\?) echo "Bledna opcja: -$OPTARG" >&2
|
||||||
exit ;;
|
exit 1
|
||||||
|
;;
|
||||||
|
:)echo "Opcja -$OPTARG wymaga argumentu" >&2
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
DATE=$(date -r /tmp/$LOCATION.json +%s)
|
DATE=$(date -r /tmp/$LOCATION.json +%s)
|
||||||
@ -25,23 +29,30 @@ function weather {
|
|||||||
|
|
||||||
JSON=$(cat /tmp/$LOCATION.json)
|
JSON=$(cat /tmp/$LOCATION.json)
|
||||||
clear
|
clear
|
||||||
|
if [ $FAHRENHEIT != true ]; then
|
||||||
echo "Kraj $(echo $JSON | jq -r '.location.country')"
|
echo "Kraj $(echo $JSON | jq -r '.location.country')"
|
||||||
echo "Miasto $(echo $JSON | jq -r '.location.name')"
|
echo "Miasto $(echo $JSON | jq -r '.location.name')"
|
||||||
if $FAHRENHEIT == true
|
echo "Czas lokalny $(echo $JSON | jq -r '.location.localtime')"
|
||||||
then
|
|
||||||
echo "Temperatura $(echo $JSON | jq -r '.current.temp_f') °F"
|
|
||||||
else
|
|
||||||
echo "Temperatura $(echo $JSON | jq -r '.current.temp_c') °C"
|
echo "Temperatura $(echo $JSON | jq -r '.current.temp_c') °C"
|
||||||
fi
|
|
||||||
if $FAHRENHEIT == true
|
|
||||||
then
|
|
||||||
echo "Temperatura odczuwalna $(echo $JSON | jq -r '.current.feelslike_f') °F"
|
|
||||||
else
|
|
||||||
echo "Temperatura odczuwalna $(echo $JSON | jq -r '.current.feelslike_c') °C"
|
echo "Temperatura odczuwalna $(echo $JSON | jq -r '.current.feelslike_c') °C"
|
||||||
fi
|
|
||||||
echo "Predkosc wiatru $(echo $JSON | jq -r '.current.wind_kph') km/h"
|
echo "Predkosc wiatru $(echo $JSON | jq -r '.current.wind_kph') km/h"
|
||||||
echo "Cisnienie $(echo $JSON | jq -r '.current.pressure_mb') hPa"
|
echo "Cisnienie $(echo $JSON | jq -r '.current.pressure_mb') hPa"
|
||||||
|
echo "Opad $(echo $JSON | jq -r '.current.precip_mm') mm"
|
||||||
echo "Wilgotnosc $(echo $JSON | jq -r '.current.humidity') %"
|
echo "Wilgotnosc $(echo $JSON | jq -r '.current.humidity') %"
|
||||||
|
echo "Ostatnia aktualizacja $(echo $JSON | jq -r '.current.last_updated')"
|
||||||
|
else
|
||||||
|
echo "Kraj $(echo $JSON | jq -r '.location.country')"
|
||||||
|
echo "Miasto $(echo $JSON | jq -r '.location.name')"
|
||||||
|
echo "Czas lokalny $(echo $JSON | jq -r '.location.localtime')"
|
||||||
|
echo "Temperatura $(echo $JSON | jq -r '.current.temp_f') °F"
|
||||||
|
echo "Temperatura odczuwalna $(echo $JSON | jq -r '.current.feelslike_f') °F"
|
||||||
|
echo "Predkosc wiatru $(echo $JSON | jq -r '.current.wind_mph') mph"
|
||||||
|
echo "Cisnienie $(echo $JSON | jq -r '.current.pressure_in') inHg"
|
||||||
|
echo "Opad $(echo $JSON | jq -r '.current.precip_in') inches"
|
||||||
|
echo "Wilgotnosc $(echo $JSON | jq -r '.current.humidity') %"
|
||||||
|
echo "Ostatnia aktualizacja $(echo $JSON | jq -r '.current.last_updated')"
|
||||||
|
fi
|
||||||
|
|
||||||
}
|
}
|
||||||
if $DYNAMIC == true
|
if $DYNAMIC == true
|
||||||
then
|
then
|
||||||
@ -54,3 +65,15 @@ else
|
|||||||
|
|
||||||
weather
|
weather
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user