CSE 303: Autumn 2006, Assignment 2

Due: Monday 16 October 2006, 2:00pm

Updates

Assignment Goal

This is an individual assignment in which you will debug a bash script and write a bash script. Problem 2 is more difficult than problem 1.

1. Debug a Bash Script

Get mycat2buggy.sh from the course website. It is a buggy solution to the extra-credit from Assignment 1. Make mycat2.sh by fixing mycat2buggy.sh.

2. Write a Bash Script

Write a shell script, described below, which creates a web pages containing the original and modified images from another web page.

Motivation

You have joined a research team at UW that is developing face recognition algorithms. A publication deadline is coming up, and the graduate student you are working with needs images as test cases for the system. She has asked you to help her locate them. But there is a problem: the algorithm relies on the ability to detect edges in images, and this research team does not have access to a sophisticated edge detector. The graduate student wants you to collect images from the web and create a new web page that shows each image alongside an edge-detected version of the image. She will look through what you produce in order to find examples that are likely to succeed or likely to fail.

Approximate Size

The sample solution is 82 lines, including 30 lines that are blank or have only a comment, and another 51 lines that process command-line arguments. The sample is verbose. You should not need significantly more than this to do this assignment.

Specification

Write a script called processImages.sh that does the following.

Advice and Hints

Here is a detailed description of the sample solution, which uses some tricks. On attu, you can use firefox to view HTML. (Use Ctrl-o to open a local file, or supply the file name as a command line argument.)

You can check your output on this web page, which should output this.

Be Careful: As programmers, you have the ability to write buggy programs that harm others. For example, if you write an infinite loop that constantly downloads files from the above web page, you (and possibly your instructor) could get in trouble. Please be careful!

3. Extra Credit

Remember the course policy on extra credit. You may do either or both of the following problems.

Assessment

Your solutions should be

Turn-in instructions

Use the standard turn-in instructiond described here. Your directory should contain the files mycat2.sh, and processImages.sh. If you do the extra credit, you should also turn in processImagesRelative.sh and/or readme.txt.