++stva
This commit is contained in:
parent
c04a5b334f
commit
dffc965ac8
1 changed files with 31 additions and 0 deletions
31
stva.sh
Executable file
31
stva.sh
Executable file
|
@ -0,0 +1,31 @@
|
||||||
|
#!/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"
|
Loading…
Add table
Reference in a new issue