Lab 16

Back Up Next

horizontal rule

Home
Lab 1
Lab 2
Lab 3
Lab 4
Lab 5
Lab 6
Lab 7
Lab 8
Lab 9
Lab 10
Lab 11
Lab 12
Lab 13
Lab 14
Lab 15
Lab 16
Lab 17
Lab 18
Lab 19
Lab 20

Lab 16

(Chapter 16)

 

 


 

Learning Objectives

  1. To learn how to process numeric data in Bourne shell
  2. To learn how to use the here document facility of Bourne shell in a script
  3. To learn how to use the signal/interrupt process facility of Bourne shell
  4. To learn how to use file descriptors in a Bourne shell script to do file I/O
  5. To learn how to use functions in Bourne shell scripts
  6. To learn how to debug a Bourne shell script

Lab Work

  1. Log on to your UNIX system
  2. Write a Bourne shell script cv that takes the side of a cube as a command line argument and displays the volume of the cube. Do proper exception handling in your code. Show the script and its sample executions.
  3. Modify the countup script in Section 16.2 so that its takes two integer command line arguments. The script displays the numbers between the two integers (including the two numbers) in ascending order if the first number is smaller than the second, and in descending order if the first number is greater than the second. Name the script count_up_down. Do proper exception handling in your code. Show your script. Capture its sample executions with the following conditions: the first argument greater than the second, the first argument smaller than the second, and the two arguments the same.
  4. Write a Bourne shell script that prompts you for a user ID and displays login name, user’s name, and pathname for user’s home directory. Do proper exception handling in your code. Show your code. Show a few sample runs of your script.
  5. Write a Bourne shell script that takes a directory as an argument and removes all the ordinary files under it that have .o, .gif, .ps, and .eps extensions. If no argument is specified, the current directory is used. Do appropriate exception handling in your code. Show your code and a few sample runs of the code.
  6. Enhance the diff2 script in Section 16.5 so that it displays the line numbers where two lines differ. Do appropriate exception handling.
  7. Implement the script outlined in the last problem of Lab 15, but use functions to implement the service code for the various options.
  8. Go through the debugging exercise outlined in Section 16.7. Show your work.
  9. Log out.

 

horizontal rule

Back to CS140U Homepage
This page was last modified September 26, 2004
wmorales@pcc.edu