wgetとdiffでコンテンツの書き換えを監視するスクリプト

#!/bin/sh
PREVIOUS_FILE=/tmp/content_previous.txt
CURRENT_FILE=/tmp/content_current.txt
URL=http://yourcontents.com/

wget -O ${CURRENT_FILE} ${URL}
if [ -f ${PREVIOUS_FILE} ]; then
        diff ${CURRENT_FILE} ${PREVIOUS_FILE}
        if [ $? -ne 0 ]; then
                echo "file changed"
        fi
fi
alias cp=cp
cp -frp ${CURRENT_FILE} ${PREVIOUS_FILE}