CSc 3320 System-Level Programming
Fall 1999
Homework #1
Due: 1 October 1999 (Friday)


Write a Csh script called, handin, which accepts an assignment number and one or more file names as command line parameters and copies the files to a specific directory. The directory to which the file should be copied is

/tmp/3320/N/USER/
where N is the assignment number and USER is the Unix userid of the person running the handin script. You may assume that the /tmp/3320/N directory already exists (I have already created five directories called 1, 2, 3, 4, and 5 at this location on zeus).

For example, if the user csc3320_10 executed the following command:

% handin 3 p3.c p3.h Makefile sp.c sp.h
the script should copy the files p3.c, p3.h, Makefile, sp.c, and sp.h from the current working directory to the /tmp/3320/3/csc3320_10/ directory.

The script should handle errors such as incorrect command line parameters, files not found etc.

Also, the script should warn the user if the file being copied already exists in the destination directory and ask if the user wishes to overwrite the file. The warning should not be given and the files should be overwritten if the user specifies the -y option before the assignment number as follows:

% handin -y 5 p5.c Makefile p5.h
Your script program should create two files: handin.log and error.log which should contain messages concerning successful transfers of files and error messages for unsuccessful transfers of files respectively.