blob: 9f29f484455477dbb247f261d1c5e36eedf0305d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
|
#!/bin/sh
# Check the temperature in Wrocław, Poland
CITY="Wroc%C5%82aw"
CACHE_DIR="${XDG_CACHE_HOME:-$HOME/.cache}/weather"
FILE="$CACHE_DIR/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"
|