![]() |
CS1101: Laboratory 6(a)The
|
To familiarise students with the concepts of shell scripts.
This lab is based on material from Paul Andersen's book entitled "Just Enough UNIX".
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).
All shell scripts that you write, for this course, should be based on the
sh
shell.
A reference on this shell is available online.
You should write and submit shell-scripts that meet the following specifications.
You are required to write a shell script called myadd
which has
the following specification:
myadd
- performs addition as often as the user
requires.
myadd
myadd
:
sh
while
loop to control the number of times an
addition calculation is performed. Assume that the user wants at least
one additional calculation.
"Calculations Completed"
and
end the program.
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>
Submit both of your scripts using the following commands:
cs1101submit myaddYou're all done!
Return to the CS1101 Home Page