CS1101: Laboratory 6(a)

The while Loop

Academic Year 2006-2007

Lecturer: Dr. Barry O'Sullivan
Department of Computer Science
University College Cork

b.osullivan@cs.ucc.ie


Objective of this Lab

To familiarise students with the concepts of shell scripts.

This lab is based on material from Paul Andersen's book entitled "Just Enough UNIX".


Submission

During this lab you will write a shell script of your own. This must be submitted by 5pm Friday the 8th of December (this coming Friday).


Background

All shell scripts that you write, for this course, should be based on the sh shell. A reference on this shell is available online.


Tasks

You should write and submit shell-scripts that meet the following specifications.

Repeated Addition

You are required to write a shell script called myadd which has the following specification:

Example:

bash> myadd
Enter your first number: 10
Enter your second number: 10
The sum is 20

Do you want to perform another addition? (y/n) y

Enter your first number: 1
Enter your second number: 2
The sum is 3

Do you want to perform another addition? (y/n) n

Calculations Completed
bash>

Submission

Submit both of your scripts using the following commands:

cs1101submit myadd
You're all done!


b.osullivan@cs.ucc.ie

Return to the CS1101 Home Page