- [Instructor] Hi again, and welcome
to the next video of section five:
Tracking Changes to a Website.
In the previous video,
we've seen how to find broken links in a website.
In this video,
we'll see how to write a basic tracker for website changes.
Tracking changes to a website is helpful
to web developers and users.
Tracking a website manually in intervals
is really hard and impractical.
Hence, we can write a change tracker
running at repeated intervals.
When a change occurs, it can play an audio,
or send some other notification.
Tracking changes, in terms of Bash scripting,
means fetching websites at different times,
and taking the difference by using diff command.
We can use curl and diff to do this.
Let's write a Bash script by combining different commands,
to track changes in a web page.
Let's look at the output of the track_change.sh script
when changes are made to the webpage,
and when the changes are not made the the page.
First, run the following command.
Second, run the following command.
Third, run the following command
after making changes to the webpage.
The script checks
whether the script is running for the first time
by using this:
if last.html doesn't exist,
it means that it's the first time,
and hence, the webpage must be downloaded
and copied as last.html.
If it's not the first time,
it should download the new copy, recent.html,
and check the difference by using the diff utility.
If there are changes, it should print the changes,
and finally, copy recent.html to last.html.
Awesome, we've successfully learned
how to track changes to a website.
In the next video,
we'll learn about posting to a webpage
and reading the response.