Unix Programming

Only available on StudyMode
  • Topic: Konrad Zuse, BMW Z3, Nepal
  • Pages : 9 (877 words )
  • Download(s) : 75
  • Published : January 6, 2013
Open Document
Text Preview
Table of Contents
INTRODUCTION3
SCRIPT4
TESTING7
Testing with valid inputs7
Testing with invalid inputs8
CONTENTS OF THREE FILES (TEXTS)10
A110
N110
M110
CONCLUSION11
REFERENCES12


INTRODUCTION
The main objective of this course work is to develop a small program in the UNIX environment either by using Bash shell or Korn shell. After creating the program, the students have to test the program for any errors/bugs. If any errors are found the students are required to diagnose/troubleshoot the bugs. This type of course work is very helpful to the IT students especially to those students who want to build their future milestone in computing.  

SCRIPT
print
print "Welcome to the program. Your ID is "$2
print "You are "$1
date

mainloop="yes"
until [ $mainloop = "no" ]
do

rloop="yes"
while [ $rloop = "yes" ]
do
print
print "#### Regions of Nepal #####."
print
print "Z1Eastern"
print "Z2Central"
print "Z3Western"
print "Z4Mid Western"
print "Z5Far Western"
print
print "Choose your birth place:\c"
read bplace
case $bplace in
Z1)
print "You chose Eastern"
print "Illam lies in this region"
rloop="no"
;;
Z2)
print "You chose Central"
print "kathmandu lies in this region"
rloop="no"
;;
Z3)
print "You chose Western"
print "Pokhara lies in this region"
rloop="no"
;;
Z4)
print "You chose Mid Western"
print "Karnali lies in this region"
rloop="no"
;;
Z5)
print "You chose Far Western"
print "Doti lies in this region"
rloop="no"
;;
*)
print "You are out of track choose again."
rloop="yes"
;;
esac
done

loop="no"
until [ $loop = "yes" ]
do

print
print "#### Tribes of Nepal ####"
print
print "N1Newari"
print "M1Maithili"
print "B1Bhojpuri"
print "A1Arya"
print "MN1Mangol"
print "K1Krati"
print "Bh1Bharopeli"
print
print "Choose any three [remember to keep spaces] :\c"
read tribe1 tribe2 tribe3

tloop="no"
until [ $tloop = "yes" ]
do
PS3="Choose any one [1/2/3] "
select dtribe in "$tribe1" "$tribe2" "$tribe3"
do
if [[ -z "$dtribe" ]]
then
print "Choose again"
tloop="no"
else
print "You Chose "$dtribe
tloop="yes"
case $dtribe in
N1)
ksh N1
loop="yes"
;;
M1)
ksh M1
loop="yes"
;;
A1)
ksh A1
loop="yes"
;;
*)
print "The file does not exists or is not readable."
loop="no"
;;
esac
fi
break
done
done
done

print
print "Do you want to run this program again ? [yes/no]:\c"
read mainloop
done

TESTING
Testing with valid inputs

Script started on Thu 03 Jan 2013 11:02:09 AM NPT
]0;serizawa@serizawa-Vostro-1450: ~serizawa@serizawa-Vostro-1450:~$ ksh 11066012cw2 Sanjay SAS1845

Welcome to the program. Your ID is SAS1845
You are Sanjay
Thu Jan 3 11:02:48 NPT 2013

#### Regions of Nepal #####.

Z1Eastern
Z2Central
Z3Western
Z4Mid Western
Z5Far Western

Choose your birth place:Z2
You chose Central
kathmandu lies in this region

#### Tribes of Nepal ####

N1Newari
M1Maithili
B1Bhojpuri
A1Arya
MN1Mangol
K1Krati
Bh1Bharopeli

Choose any three [remember to keep spaces] :N1 M1 A1
1) N1
2) M1
3) A1
Choose any one [1/2/3] 3
You Chose A1
You
are
Arya

Do you want to run this program again ? [yes/no]:no
]0;serizawa@serizawa-Vostro-1450: ~serizawa@serizawa-Vostro-1450:~$ exit

Script done on Thu 03 Jan 2013 11:03:24 AM NPT

Testing with invalid inputs

Script started on Thu 03 Jan 2013 11:03:36 AM NPT
]0;serizawa@serizawa-Vostro-1450: ~serizawa@serizawa-Vostro-1450:~$ ksh 11066012cw2 Sanjay SAS1845

Welcome to the program. Your ID is SAS1845
You are Sanjay
Thu Jan 3 11:03:48 NPT 2013

#### Regions of Nepal #####.

Z1Eastern
Z2Central
Z3Western
Z4Mid Western
Z5Far Western

Choose your birth place:Z6
You are out of track choose again.

#### Regions of Nepal #####.

Z1Eastern
Z2...
tracking img