COMP 2401/2001 (W13)

Bonus Assignment

Due Wednesday April 10th at 9:00 pm

Submit a single file UserID.assignment6.tar to cuLearn with all the files specified below.

Your grade for this assignment will be based on correctness only.


  1. A short diversion here.


  1. Weather Report: Write a bash script called weather. Your script should grab the current temperature (as given by the Weather Network's RSS feed). When you run your script, it should output (to stdout) the current temperature (a number followed by a C). For example, (bold is what you enter and what is displayed)

       linux/scripts:$ ./weather
       -1 C
    

    Make sure that your script is executable. You will need to use chmod to do this. Shell commands that may be useful in this problem are wget, grep(simple usage), cut, head.

  2. Resizing Images: Install imagemagick if it not installed on your linux machine. Once imagemagick is installed, you will have a program called convert. This program allows to convert one image into another. For this problem, you will write a bash script that creates thumbnail images of a collection of jpg files. Create a bash script call small that optionally accepts two command line arguments. Its usage is given by

    Usage: ./small [width height]
    
    where square brackets means optional. So, you can call small with no command line arguments or with two. If the user calls the script in any other way, your script should display (to stdout) the usage message above and then terminate.

    Your script will create a smaller copy of every jpg file in the current directory. This includes all files with jpg, JPG, jpeg and JPEG extensions. For a given file, say fileA1.jpg, the smaller image should be in a file called fileA1_WxH.jpg, where W is the width and H is the height of the new smaller picture (these lengths are pixel lengths). (You might find the command basename useful.)

    Warning! When testing your script, make sure all your jpgs have copies. It is very easy to overwrite your files and lose the originals. Just gab some random pics from the web so that if you clobber them it doesn't matter.

    If there is no command line arguments, the thumbnail pictures should be 20x20 pixels. (That is, W=H=2.) If two command line arguments are provided, they will specify the width H and height H of the thumbnails (in pixels).

    Note: See imagemagick for more things you can do with imagemagick. (There is a lot!)

  3. NCURSES: Use the ncurses library to implement a simple game[1].

    Your game should:

    [1] Your game can be very simple. It needs to be interactive with the user. It also must show that you did a bit of research into ncurses and that you are using more than 1 or 2 functions from it.


Last modified : March 22, 2013