Lab 18

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 18

(Chapter 18)

 

 


 

Learning Objectives

  1. To learn how to process numeric data in C shell scripts
  2. To learn how to use the here document facility of C shell in a script
  3. To learn how to process arrays in C shell scripts
  4. To learn how to use the signal/interrupt process facility of Bourne shell
  5. To learn how to debug a Bourne shell script

Lab Work

  1. Log on to your UNIX system.
  2. 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.
  3. Modify the script in the above problem so that it reads integers to be added as a here document.
  4. 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.
  5. 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.
  6. Show working of the scripts fs (Section 18.3) and onintr_demo (Section 18.5). Show a few sample runs.
  7. Log out.

 


 

 

horizontal rule

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