diff options
| author | filip <“filip.rabiega@gmail.com”> | 2026-01-21 13:10:55 +0100 |
|---|---|---|
| committer | filip <“filip.rabiega@gmail.com”> | 2026-01-21 13:10:55 +0100 |
| commit | 4d1bfe67ab1e72e9dd2d700faf4b396746ddae9a (patch) | |
| tree | 97a4a5fbbb1f8ae7a09070cd7df7927de27244a6 | |
| parent | 88f0243428c4cf39029c8ffc5a7e1634951158a0 (diff) | |
| download | chadscripts-4d1bfe67ab1e72e9dd2d700faf4b396746ddae9a.tar.gz chadscripts-4d1bfe67ab1e72e9dd2d700faf4b396746ddae9a.tar.bz2 chadscripts-4d1bfe67ab1e72e9dd2d700faf4b396746ddae9a.zip | |
wrocwttr rewrite
| -rwxr-xr-x | wrocwttr | 16 |
1 files changed, 9 insertions, 7 deletions
@@ -1,12 +1,14 @@ #!/bin/sh +# Check the temperature in Wrocław, Poland -# export DISPLAY=:0.0 -# export HOME=/home/filipek +CITY="Wroc%C5%82aw" +CACHE_DIR="$HOME/.cache/weather" +FILE="$CACHE_DIR/wroc.txt" -# ł is URL-encoded -temp=$(curl "wttr.in/Wroc%C5%82aw?format=1" | awk '{print $2}') -file="$HOME/.cache/weather/wroc.txt" +mkdir -p "$CACHE_DIR" + +temp="$(curl -fsS --max-time 5 -A "wrocwttr/1.0" \ + "https://wttr.in/$CITY?format=%t")" || exit 1 [ -z "$temp" ] && exit 1 -echo "$temp" > "$file" -# notify-send "Temperature updated." +echo "$temp" > "$FILE" |
