UC Irvine, Information and Computer Science Department

ICS 54 Winter 2000: Homework 3

This assignment is to be done individually.
All work for it should be done in a special directory (on a UCI UNIX system, either ICS or OAC-EA) which you set aside for the purpose which contains no other work and which you keep for future reference and use in this course.
Suggestion: Have a ics54 directory and put the work for this assignment in an ics54/hw3 subdirectory.
This assignment is due at the start of class, Wednesday, February 9.
You will turn in a printout with a separate cover/title page containing:
(1) Your Personal Identification (Name, Student ID number, and UCInetID),
(2) Assignment Identification (course name and quarter plus assignment number).
Please print separate parts of the assignment on separate sheets and label the pages appropriately.

The TA or Instructor will be available in CS 364 at the following times:

The Instructor will also be available in his office (Engineering Gateway 2149) Monday, February 7: 4:30-5:30 p.m.
  1. Create a (Bourne) shell script SpellCheck so that
         SpellCheck Where SFX Age Results
    will search the directory Where and all directories under it for files whose names end in the suffix SFX and which have been modified in the last Age days. For each such file it finds, the name of that file, preceded by "===" should be added to the file Results and then all misspellings in the file found should be added to Results. Anything that was in Results before SpellCheck is run will be destroyed.

    Hints:  Use the find command to find the files. Use a separate shell script to process each file found. Separately check the find portion of your solution and this other shell script. There are a number of ways that one can make Results an empty file before you start to add things to it. So that you will have files that are at least a few days old, create some sample data files before you do anything else with this assignment other than read it.

    For this part, you should submit a well commented listing (WCL) of SpellCheck and at least 3 sample runs showing how (well) it works. Include also (of course) an explanation of the sample runs, stating how they show that your SpellCheck works well.

     

  2. Create a (Bourne) shell script NewName such that "NewName sname" will create a name/string of the form "sname.garbage" where garbage is some collection of characters that is almost sure to be different each time you invoke the NewName command. (Hint:  "$$" will give you a number that changes from one process to the next (why?) and the date command produces values that change over time (of course,  :-)  ).

    For this part, submit the same type of WCL and sample runs with explanations as you did for the previous part.

     

  3. Create a C shell alias NewNameC which does the same thing as NewName without (of course!) using NewName.

    For this part, submit the same type of listings as with the previous parts.

     

  4. Create a (Bourne) shell script MyFriends which considers its arguments to be a list of friends' user names and lists all the processes these friends are running (sorted by user names). (Hint:  With appropriate options and arguments, the following comands might be of use: ?grep tr ps)

    For this part, submit the same type of listings as with the previous parts.

     

  5. For each of the following commands create a set of examples (the number expected is given in parentheses after each command) illustrating the command's distinct capabilities: grep(3), fgrep(2), egrep(3), sort(3), tr(2), uniq(3).

    You are both allowed and encouraged to produce examples which illustrate more than one of these at a time and which use other commands as well. Thus, the example shown in class
         tr -cs '[A-Z][a-z]' '[\012*]' < F | sort |\
         uniq -c |sort +nr | head -10'

    would be, with suitable explanation and a sample run, a fine example of the use of "tr," "sort," and "uniq" (with "head" thrown in for good measure) had it not been preempted by its use in class. (So it goes.)

    On the other hand, since this is an individual assignment and there are literally millions of possible examples, it would be both most surprising and most unfortunate if two people submitted examples that were essentially the same.


Comments are welcome.
Current as of 30 January 2000
HTML 4.01 Checked.