I want to grab a copy of the website and store the md5 signature of the
index page in a file I am calling "journal.txt". Every few hours, I want to
fire the script and grab a fresh copy of the page. If the signature of the
page does not match the last entry in the journal, I will tell it to send me
an email. The problem is that I can't get it to recognize that the signature
is different. Echoing both variables to the screen shows that the correct
values are being stored in each variable, so I know it's playing with the
right strings. Does anybody know why $OLDHASH and $NEWHASH are being treated
as the same even when they are different? Is it possible that text strings
need some kind of special treatment?
Here's the part that's giving me problems:
----------------begin--------------------
!# /bin/bash
wget http://www.website.com
OLDHASH=`tail -1 journal.txt`
echo "The old signature is $OLDHASH"
NEWHASH=`md5sum index.html`
echo "The new signature is $NEWHASH"
md5sum index.html >>journal.txt
mv index.html index.html-$(date +%y%m%d%H%M)
if [ "$OLDHASH"=="$NEWHASH" ] ; then
echo "No changes detected"
fi
------------------end------------------------
Thank You for your time
--
Julie Ventimiglia