CSc 352 (Summer 03)
Systems Programming and UNIX
Homework 1
Start: 06/11/03
Due: 06/16/03, 9:00pm
Turnin ID: cs352_assg1

Background Reading

Use our C Shell textbook and all possible methods of getting help on UNIX commands we introduced in the class to get the information, you think necessary in doing this assignment, about the following commands:

  • turnin
  • echo
  • wc
  • sort
  • cat
  • head
  • tail
  • grep
  • find
  • whoami
  • script

Assignment Description

You are to create three files, aboutme, typescript, and output as directed below, and then submit them electronically on host lectura.cs.arizona.edu using the command:

turnin cs352_assg1 aboutme typescript output

Please follow the directions below carefully: submissions that don't follow directions will be penalized heavily.

  1. Use your favorite UNIX text editor (emacs and vi are recommended but not required) to create and edit a file named aboutme, in which you are to describe the following thing about yourself:
    1. Your name and your lectura login ID,
    2. the name of the UNIX editor you are using,
    3. your major,
    4. why you are enrolled in this course (CSc 352), and how it relates to your major. Use wc to make sure that this file contains at least 20 lines and 100 words.
  2. Use the command script to create the file typescript that contains a transcript of you typing various commands to perform the following actions. You may want to practice before you finally generate the typescript file. Append the output of each command to the file output.
    For item 10 below, you need multiple commands to set, display and unset the variable respectively. But for all the other items, you should finish each of them with only one command line (i.e. only press ENTER once). However in the single command line, you could use multiple commands, command group or pipes.
    Only the information explicitly asked to be displayed needs to be displayed; other information should not be displayed. For example, in item 3, only "the number of words" should be displayed and the filename should not appear.
    1. display your login name.
    2. display all the evironment variables.
    3. display the number of words in the file /home/cs352/summer03/assignments/hw1/files/file1.
    4. display the number of all files (including hidden files whose names begin with ".") in the directory /home/cs352/summer03/assignments/hw1/files
    5. display the size (in numberof blocks) and filename of the largest file in the directory /home/cs352/summer03/assignments/hw1/files
    6. display the contents of the file /home/cs352/summer03/assignments/hw1/files/file1 with the line number on the left side of each line
    7. display the 10th through the 15th line (i.e. line 10, 11, 12, 13, 14, and 15) of the file /home/cs352/summer03/assignments/hw1/files/file1
    8. in the directory /home/cs352/summer03/assignments/hw1/files, apply wc command to all the files whose filenames match the pattern text*
    9. for each file in the directory /home/cs352/summer03/assignments/hw1/files, print all the lines that contain "cs352" either as a word or as a substring (i.e. a line "I am in cs352 today" and line "I am in cs352summer" are all qualified to be displayed)
    10. set the shell variable myshellvar to value 12345, display its value and then unset the variable myshellvar

CS Home | UA Home
Last Updated: 06/08/03 By Stanley Yao