nsbin/stva.sh

33 lines
548 B
Bash
Raw Normal View History

2021-08-27 16:32:22 +00:00
#!/bin/sh
i=1
new_data="yes"
data=""
newfile=~/.stva-new
oldfile=~/.stva-cur
while [ "$new_data" ]; do
2022-04-13 17:05:39 +00:00
new_data=$(curl -Ls "https://e-schild.stva.gl.ch/?page=${i}&category=1" | \
2021-08-27 16:32:22 +00:00
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"
2021-12-02 10:29:01 +00:00
echo "Full info at https://e-schild.stva.gl.ch/"