CS211b Assignment 2

Issued on: Friday, January 19, 2007.
Due by: Tuesday midnight, Febury 6, 2007

HOW TO SUBMIT

For this assignment, a paper submission is sufficient. There is no need of an electronic submission. However, you still need an assignment ticket.

Put the assignment ticket and your paper submission in an envelope. The locker of CS211b is 99 at the groundfloor of Middlesex College.

QUESTION 1 (25 marks)

We assume that in our current directory we have a directory called Programs which contains a collection of C programs.

We want to create a new directory structure called Distrib which contains these C programs. The organization will be similar to that of lecture-c-programs that you can download from the course web site: Live C programs used in our lectures. So, this directory Distrib will contain three subdirectories called bin, ps and src together with a file named Makefile. Each of the subdirectories itself will contain files. We assume that:

You are asked to write a sequence of shell commands (in tcsh, csh or bash) in order to perform the following actions.

QUESTION 2 (25 marks)

Explore more commands by yourself. Use man command to learn the command find and grep.

Then help me solving the following problem. On my laptop, I have a collection of directories corresponding to the different courses I have taught or that I am currently teaching. Here's a list of these directories:

AM583      CL2      CS211      CS435      CS545      CS558      CS855     
CS874      FTI      Paris6      Yale      APPR      CS210      CS424     
CS447      CS556      CS652      CS867      Erable      FTM      SM2     

Each directory contains at most 3 levels of subdirectories.

You are asked to write a sequence of shell commands (in tcsh, csh or bash) in order to perform the following actions.

QUESTION 3 (10 marks)

Provide one-line Unix commands to solve each of the following tasks:

QUESTION 4 (15 marks)

Read the man page for the Unix commands script and finger. Then, answer the following questions.

QUESTION 5 (10 marks)

Assume that the following files are in the current directory:

intro      notesb      ref2      section1      section3      section4b     
notesa      ref2      ref3      section2      section4a     

What one-line commands (including wild cards) can you use to

QUESTION 6 (15 marks)

Using echo, give a one-line command which displays the picture on the line following the command.

/ \ / \
\ / \ /