The goal that I am trying to accomplish is to pull HTML code from a website, write it to a file. Once this is done, I want to loop it to do it again and write it to another file. After the second file is written I want it to compare the two files together to see if anything has changed. Here is what I have so far, and it does not work:
#!/bin/bash
echo "Hopefully this will do everything at once!"
while true;
do
wget -q -O - http://website.com > websitebaseline.txt
if -e websitebaseline.txt
then
wget -q -O - http://www.website.com > websitechange.txt
echo "Update to websitechange.txt has been made"
if !-e websitebaseline.txt
then
wget -q -O - http://www.website.com > webbaseline.txt
echo "Baseline has been created"
if -e websitebaseline.txt websitechange.txt
then diff -y websitebaseline.txt websitechange.txt --supress-common-lines > Changeinsite.txt
if !-e websitebaseline.txt
then
wget -q -O - http://www.website.com > websitebaseline.txt echo "Baseline has been created"
elif !-e websitechange.txt
then
wget -q- O - http://websitename.com > websitenamechange.txt
echo "Update has been made"
sleep 100;
done