CSC 3120 UNIX-SHELL PROGRAMMING
CSC 3120 UNIX-SHELL PROGRAMMING
PAUL’S UNIVERSITY
. P A U L ’S
UN
I VE R S I TY
Private Bag 00217 Limuru, KENYA
S T
SE R
VANT
S OF GO D AND HUMANI
TY
Tel: 020-2020505/2020510/0728-669000/0736-424440
QUESTION ONE
a) Using examples, define the following commands used in Unix-Shell programming. (6 Marks)
i. grep
ii. sed
iii. awk
c) Write a simple shell script that asks the user to enter his name and displays a personalized message
“Welcome to Unix-Shell Programming.” (3 Marks)
d) Distinguish between UNIX operating system and Windows operating system. (3 Marks)
f) Describe the sort filter and illustrate its usage with -k, -u, -n, -r, and -c options. (5 Marks)
b) Illustrate using simple examples TWO main ways of running a shell script. (4 marks)
c) Discuss THREE attributes of every file that exist in UNIX operating system. (6 marks)
d) Write a simple shell script to find out the unique words in a file. The script should also help to count
the occurrence of each of the unique words. Assume that the file under consideration contains many lines,
and each line has multiple words. (6 marks)
QUESTION THREE
a) Outline FOUR application areas of Unix-shell programming. (4 marks)
b) Discuss THREE different quote characters and their behaviours as used in shell scripting. (6 marks)
c) By use of a simple diagram, illustrate the main concepts that unite all the versions of UNIX operating
systems. (4 marks)
d) Write a menu driven shell script that prints out a 12 by 12 multiplication table. (6 marks)
QUESTION FOUR
a) State FOUR types of UNIX shells that exist in the market today. (4 marks)
b) Distinguish between the TWO main methods used to change file/directory permissions in UNIX operating
system. (4 marks)
c) Discuss THREE types of logic structures supported by shell scripts. (6 marks)
d) Write a menu driven script that prints the average marks of five students in a class. (6 marks)
QUESTION FIVE
a) Describe FOUR advantages of shell scripting. (4 marks)
b) By use of examples, explain THREE different types of variables supported by shell scripting.
(6 marks)
c) Explain the THREE distinct phases of process creation and state how the shell is created. (6 marks)
d) Write a shell script that compares two numbers, and then prints the smallest of the numbers.
(4 marks)