




















| |
Lab 16
(Chapter 16)
Learning Objectives
- To learn how to process
numeric data in Bourne shell
- To learn how to use the
here document facility of Bourne shell in a script
- To learn how to use the
signal/interrupt process facility of Bourne shell
- To learn how to use file
descriptors in a Bourne shell script to do file I/O
- To learn how to use
functions in Bourne shell scripts
- To learn how to debug a
Bourne shell script
Lab Work
- Log on to your UNIX system
- 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.
- 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.
- 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.
- 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.
- Enhance the diff2 script in
Section 16.5 so that it displays the line numbers where two lines differ. Do
appropriate exception handling.
- Implement the script
outlined in the last problem of Lab 15, but use functions to implement the
service code for the various options.
- Go through the debugging
exercise outlined in Section 16.7. Show your work.
- Log out.
|