Sie sind auf Seite 1von 2

CP5290 Assignment: The Phonebook

Due 4 pm Friday 10th October 2008 Weight: 10%

You are to implement a Phonebook using Shell scripting and UNIX command line utilities and
commands. Some documentation will also be required.

Notes about Completion of this Assignment


The Phonebook is a menu driven Phonebook that offers users a menu with options to choose
from. Based on the options selected, the appropriate action is taken. Remember to include
transcripts of the running script.

Your script should include any 5 of these 7 points mentioned

1. Display a text menu for the user to choose from


2. Display Usage/Help for example (type ls --help for a detailed example)
Usage: Phonebook [-options] [-b path] [-u username] [-d datafile]
3. Implement at least two command line options to drive the script
4. Use text files (dot files) for configuration (saving selections and loading selections)
5. Check for presence of data files and first time installation
6. Allow alternate data files to be used as source of information
7. Allow data files to be used from other users home directories (Shared Phonebooks)

Submission
Submit a single zip file called Phonebook.zip containing all of your files (Source, Scripts, etc).
Organize them properly into directories and ensure that they run when unzipped without having
to reorganize.

The assignment is to be submitted using Safe Assignment on LearnJCU. It is expected that your
files have sufficient comments so that no other documentation is needed to understand the code.

Marking Scheme
Criteria Explanation Marks available
Specifications 2 marks for each point implemented 10
Functionality Does the script run correctly on dunk (even if 10
the script looks horrible)?
Quality Is it easy to read, understand, maintain? Does 10
it use constructs well, even if it may not work
all that well?
Will look at:
Comments
Variable Names
Structure of code
Tests Has the script been properly tested? And is the 10
proof of this supplied in a file? Has the
command line functionality been properly
tested and is proof of this supplied in a file?
Modularity Appropriate use of functions 10
Total 50
Appendix 1: script: A very useful UNIX Command
To save your interaction with your program to a file use the command script

This will change your prompt to remind that it is in operation, and record actions to a file
named typescript

When you are done interacting with your program type exit at the prompt, then look at
the file typescript to see that your interactions were recorded properly.

Copy the file typescript to the file you want to keep, e.g.

cp typescript phonebook_running_transcript.txt

Appendix 2: Constructs
if [ condition ]; then
else
fi
case var in
esac
functions
for var in
do
done

Note: Clever use of script can attract bonus marks.

Appendix 3: Pipes, Conditions, Redirects


You can use Pipes to combine two or more commands as in

ls –la | grep myfile


You can have multiple commands run conditionally as in

command1 || command2 && command3


You can also use redirects to direct the output or input from alternative sources than the
standard ones.

Input: command1 < myInputFile


Output: command2 > myOutputFile

Das könnte Ihnen auch gefallen