Assignment 4
Home News & Discussion Notes Windows 95 Unix Assignment 4 Assignment 5-A Assignment 5-B Assignment 6 Assignment 7
2000-11-18 16:24

Assignment 4 - UNIX

This assignment is for sections taught by Ian Allen.
Hand in:
One printed and hand-annotated telnet session log file in hard copy form.  For full marks, follow the Assignment Submission Standards.  In particular, make sure you use Courier font and annotate your output before you hand it in.
Review the Using Telnet and Telnet Logging web pages.
You must complete Chapter 1 in your Unix text before doing Step 1 of this assignment.
You must complete Chapters 2 and 3 to do the rest of the assignment.
The last two sections of Chapter 3 are script projects you need to type in, get working, and hand in as part of the telnet session log.
Step 1.
By the time you complete Chapter 1, you will have 17 to 20 or more files listed in your home directory. After you have finished Chapter 1, create in your Unix home directory a file named my4files that contains the names of all the files in your home directory.  (Use a Unix command to create this file; do not type in all the file names!)
Step 2.
After completing pages 89-138 in Chapter 2, start using the vi text editor to type the answers to the following Chapter Reading/Study Exercises into the file named my4answers in your home directory.  You will find the Chapter Exercises under the Unix button on the course page.
    Put your name and your Algonquin e-mail address at the top of the file.
    Answer the Chapter 1 Exercises 1-3 through 1-9, 1-15, and 1-22.
    Answer the Chapter 2 Exercises 2-5, 2-7.
    Answer the Chapter 3 Exercises 3-23 through 3-29.
Put your name and your Algonquin e-mail address at the top of this file.
Step 3.
Complete Chapter 3.  Create the scripts from sections 3.17 and 3.18.  After reviewing Chapter 3, create your own script file named my4script that performs the following actions.  Some actions may be done by a single Unix command; some actions may need a pipeline of one or more Unix commands.  (Do not add extra commands to this script.  Do exactly what is requested and no more.)
  1. The very first line of the script must indicate what program is to run the script:
    #!/bin/sh -u
  2. Next, include one or more comment lines with your name, your Algonquin email address, and the date you began creating the script.
  3. Display your USER environment variable.
  4. Display today's date.
  5. Display the calendar for the month and year you were born.
  6. Change the working directory to the directory /usr/tmp
  7. Display the file names in the current working directory.  This command must work no matter what the name of the current directory is.  Do not code the name of the directory into the command line.
  8. Display your HOME environment variable.
  9. Display only the subdirectories (no files) of your home directory.  (Do not use any change directory commands to perform this action.)
  10. Count the number of people currently logged in.
  11. Count the number of words in the output of the command "man sh".
Test your script to make sure that it works and that it generates the correct output.
Step 4. (Creating the Telnet Log File)
You need to have done work in Chapters 1, 2, and 3 and completed Steps 1 through 3 of this Assignment to do this final Step. Login to Unix and then turn on telnet logging to record the following Unix session on your A: diskette or on your N: drive.  When asked to display the contents a file or script, use the  cat command.  (For full marks, do not use an editor or any commands that paginate the file, since the pagination mis-formats the display of the file in the log.)  Perform the following actions for the log file:
  1. Display your USER environment variable.
  2. Display the current date.
  3. Display the contents of the file my4files you created in Step 1.
  4. Display contents of the file my4answers you created in Step 2.
  5. Display contents of the file my4script from Step 3 and then execute it to show the correct output.
  6. Display the friends-on script file from Section 3.17 of the text and then execute it.  (Make sure it works!)
  7. Display the wordsUsed script file from Section 3.18 of the text and then execute it.  (Make sure it works!)
Turn off telnet logging.  Print the Telnet log file using a monospace (Courier) font.
Step 5. (Annotating the Telnet Log File)
Annotate your printed Telnet log file output by hand as follows:
  1. Take a pen or marker and draw long, page-width lines between each of the numbered actions you performed in the previous step.
  2. Write in (using pen or marker) the number of the action beside each of the actions.  Use the action numbers given in the previous step.
  3. Highlight or underline each of the Unix command lines you typed to the shell to do the actions in the previous step.  Do not highlight the output of the command lines.  Highlight only the Unix command lines that you typed in.

There is only one telnet session log file to hand in.  It comes from Step 4.  Do not log or hand in anything else other than the one log file from Step 4.  Make sure you annotate the log file by hand as required in Step 5.

Web Author: Ian! D. Allen
Updated: 2000-11-18 16:24