nsbin/stva.sh
Nico Schottelius a6d4d7e3b5 ++print url
2021-12-02 11:29:01 +01:00

32 lines
535 B
Bash
Executable file

#!/bin/sh
i=1
new_data="yes"
data=""
newfile=~/.stva-new
oldfile=~/.stva-cur
while [ "$new_data" ]; do
new_data=$(curl -Ls https://e-schild.stva.gl.ch/?page=${i} | \
grep '<td>GL' | sed 's/.*<td>GL //')
if [ "$new_data" ]; then
data="$data $new_data"
i=$((i+1))
fi
done
(
for num in $data; do
echo "GL${num}"
done
) > "$newfile"
# Ensure old file exists
touch "$oldfile"
diff -u "$oldfile" "$newfile"
mv "$newfile" "$oldfile"
echo "Full info at https://e-schild.stva.gl.ch/"