




















| |
Lab 18
(Chapter 18)
Learning Objectives
- To learn how to process
numeric data in C shell scripts
- To learn how to use the
here document facility of C shell in a script
- To learn how to process
arrays in C shell scripts
- To learn how to use the
signal/interrupt process facility of Bourne shell
- To learn how to debug a
Bourne shell script
Lab Work
- Log on to your UNIX system.
- Write a C shell script that
takes integer numbers as command line arguments and displays their sum. Use
the while control
structure and integer arrays. Do appropriate exception handling in your code.
Show your script and a few sample runs.
- Modify the script in the above
problem so that it reads integers to be added as a here document.
- Modify the
dext script in
Section 18.4 so that it takes a list of names as command line arguments. Use
the foreach control
structure to implement your solution. Do appropriate exception handling. Show
your code and a few sample runs.
- Write a C shell script that
prompts the user for a positive integer number from the and displays the
Fibonacci numbers equal to the number entered by the user. Thus, if the user
enters 8, your script displays the first seven Fibonacci numbers. After this,
the script prompts the user for input again. The script terminates if user
enters 0. You should not be able to terminate the program with <Ctrl-C>. When
you press <Ctrl-C>, your script displays a message and continues. Do
appropriate exception handling in your code. Show the code and a few sample
runs.
- Show working of the scripts
fs (Section 18.3) and
onintr_demo (Section
18.5). Show a few sample runs.
- Log out.
|