Maneira de complicar as coisas.
#!/bin/bash
left=$(mktemp)
right=$(mktemp)
url="http://url.example.com/"
trap 'rm -f "$left" "$right"' EXIT
for file in "$left" "$right"; do
wget -q -O "$file" "$url"
done
if diff "$left" "$right" > /dev/null 2>&1; then
echo "Changes detected in successive retrievals of '$url'."
fi
Um regime semelhante poderia ser usado para observar alterações de forma incremental ao longo do tempo:
left=$(mktemp)
right=$(mktemp)
url="http://url.example.com/"
trap 'rm -f "$left" "$right"' EXIT
# Establish the "baseline":
wget -q -O "$left" "$url"
# Okay, now check for updates forever:
while sleep 30; do
wget -q -O "$right" "$url"
if diff "$left" "$right" > /dev/null 2>&1; then
echo "$(date) - Changes detected in '$url'."
cp "$right" "$left"
fi
done