Create an Assignment Assignment

I think this assignment was a great idea. It allows the students to add input into what they think this course should cover. For this assignment, I chose to have the reader write a bash script file. Scripting is an important tool that Linux provides. It allows you to execute lines of code without you having to type all of them in. It also allows for conditional statements to change what will execute.

In my assignment, I had the reader create a bash script to check for changes on a website. This would be particularly useful when checking for some sort of update. For instance, if you want to see if VT has canceled class and don’t want to check the website continuously, you could use this script. The assignment that I created specifies that the bash script do the following in an infinite loop:

  1. Download an html web page
  2. Wait some amount of time
  3. Download the same html webpage
  4. Display the differences between the two files

In the finish script, I ended up using:

  1. wget
  2. cat
  3. sed
  4. sleep
  5. diff

While working on the final script, I found it easier to remove all of the html tags with:

sed –e :a –e ‘s/<[^>]*>//g;/</N;//ba’

Then I would use diff and pipe that to another sed command to get the formatting I wanted.

Throughout the completion of the assignment, it forced me to gain a more in depth experience with mostly sed.

, , , , , , , ,

Leave a Reply

You must be logged in to post a comment.