You are on page 1of 2

CSC8010 Linux Assignment

Introduction:
You are advised to work through Practicals 1-5 first.
Answer all parts. Submit your answers in a single document NESS will be set up to
accept .doc, .docx, and .pdf files. The deadline is Monday December 12 th, 12:00
Aim:
To gain experience with the Linux operating system
Learning/Skill Outcomes:
This coursework will enable you to practice the following skills:
Linux commands
Linux shell scripting
Specification:
Please attempt all parts to the assignment if you are unable to complete an answer in
its entirety, do include a partial solution in your answer document as it may well score
some marks. Marks for individual part questions are shown next to the questions.
Paste all of your answers into a single answer document. See below for details of
acceptable formats.
Submission and Deadlines:
Your coursework must be submitted to the NESS system by the deadline specified.
Note that NESS imposes deadlines rigorously, and even work that is a few seconds
late (e.g. because of network delays caused by students all submitting at the last
moment) will be flagged as late.
You must submit one file, in Word (.docx or .doc) format or as a PDF file.
Hints and Tips:
Before beginning this assignment, make sure you have completed all of the practical
sheets, in particular, Practical 5. If you are unsure of how to tackle a particular
question look back through the practical sheets as these may well give you a starting
point.

a) Write a shell script which adds up 10 numbers entered by the user and displays the
result to the screen. You must use the read command to obtain the numbers from
the user. (4 marks)
b) Alter the script you wrote in part a) of this question so that it works for an arbitrary
list of numbers. Again, you must use the read command to obtain all input from
the user. (5 marks)
c) Write a script which takes in a number from the user and prints out the
corresponding day of the week, e.g. Monday for 1 and Sunday for 7. Try, if you can,
to make sure the program doesnt crash if the user enters something unexpected. (5
marks)
d) Write a script which makes a new directory called MyTextFiles, copies all text
files (i.e. those ending in .txt you can ignore any permutations such as .TXT)
from the current directory to this new directory, produces a list of files within that
directory redirected to a new file called DirectoryListing.txt and displays on the
screen the number of lines in the file, DirectoryListing.txt.
(5 marks)
e) Write a shell script which looks at the contents of the current directory and for all
directories prints out the word Directory followed by the name of the directory and
a comma-separated list of the directorys contents and for all files prints out the word
File and the name of the file.
(6 marks)
Remember: all answers to this question must be submitted in a single document via
NESS.