Software Development Tools

Software Development Tools
Introductory Book
Semester 1, 2014
Published by
The University of Southern Queensland
Toowoomba, Queensland 4350
c University of Southern Queensland, 2014.1
Copyrighted materials reproduced herein are used under the provisions of
the Copyright Act 1968 as amended, or as a result of application to the
copyright owner.
No part of this publication may be reproduced, stored in a retrieval system or transmitted in any form or by any means electronic, mechanical,
photocopying, recording or otherwise without prior permission.

4 CSC2408—Software Development Tools
Essential information
The topics in the following list provide important information that will
assist you with your study. You can access a handout containing the information on your StudyDesk through the Essential information (study materials)
You will need your UConnect username and password to access the file.
Please make sure you read this information carefully before commencing
your study.
Getting started
Course specification
Assignment submission
Grading levels
Course evaluation
Residential schools
Referencing APA
Referencing Harvard AGPS
Optional purchase of study materials
USQ policies and procedures
Welcome to the course CSC2408, Software Development Tools. The aim of
this course is to give you a sound basic knowledge of the most important tools
available under the Unix operating system. This is particularly important
as many of the courses which you will undertake require use of Unix, and
c University of Southern Queensland

CSC2408—Software Development Tools 5
appropriate use of the tools provided will make your practical work much
easier to complete.
Although the focus of this course is on Unix tools, many of the tools that
you will use are generic. That is, tools of very similar functionality, though
most likely with a different interface, exist under other operating systems.
Hence Unix-specific knowledge gained in this course can be transferred later
to other operating environments.
A look at the table of contents of the Study Book will indicate the topics
covered. Note that installing Linux is
not an assessable part of the course —
we assume that you have used the materials available on the Departmental
DVD-ROM set to install Linux.
This course is user-focused; we concentrate entirely on tools used by the
general user, rather than the system administrator. System administration
is covered by another course by name of
System and Security Administration.
Course Organization
The Study Book together with the Study Schedule on page ?? of this book
are your main guides to completing this course. You should work through
the Study Guide at the rate described in the Study Schedule. Many of the
exercises in the Study Book must be completed and handed in for assessment.
It is strongly recommended that you attempt all exercises, whether
or not they are assessable. Be aware that skills and knowledge gained from
completing non-assessable exercises may still be examined in the examination.
Resource Materials
Study Book
This is your primary reference. It contains some original material which will
be needed to complete exercises, but most of the study material is derived
from the textbook. The Study Book contains a large number of exercises;
many of these must be completed and handed in for assessment.
c University of Southern Queensland

6 CSC2408—Software Development Tools
Text book
There are a number of excellent texts about the Unix operating system.
Some are brief introductions, while others are much wider in scope. Some
texts also include some programming guidance. We have chosen the
A Practical Guide to Linux Commands, Editors, and Shell Programming by Sobell.
This is an excellent book. It is perhaps less tutorial in style than some
other books, but it contains a wealth of detailed, well organized information. While it is not the appropriate choice for someone wanting a quick
introduction to Unix, it is ideal as a long term companion.
You may choose to use or consult other Unix texts rather than the recommended text. This is acceptable and as long as you are able to complete the
exercises and can cover the conceptual material contained in chapters 2, 3
and 4.
These are supporting documentation not covered by the textbook. Also
included for your convenience are copies of some Unix man pages. The
largest part of the Readings is the complete
GNU Make manual, which you
should find useful in many other courses.
You may need to purchase the Department DVD-ROM set from the USQ
The “Software” DVD-ROM contains Windows, Mac OS X and Linux software. Most of the software is
not essential for this course.
The “Debian/GNU Linux Distribution” DVD-ROM contains all the software
required to install the most recent version of Debian Linux on your system,
or to upgrade from an older Debian installation. It is accompanied by an
instruction booklet describing the installation process.
Course DVD-ROM
The course DVD-ROM contains a complete pre-installed Virtual Debian
system created from the Department’s Debian/GNU Linux Distribution.
This DVD-ROM is for emergency use only. It is for students having trouble
installing Debian Linux on their computer—they will have access to a Linux
distribution that will allow them to do the exercises and assignments without
falling behind—while they sort out the problems of their installation.
c University of Southern Queensland

CSC2408—Software Development Tools 7
A virtual operating system is
no substitute for an installed operating system—
remember this is not the only course you will do that will require access to
a Linux operating system—it is far better to install the Operating System
rather than rely on a virtual system.
All course material is available from the Course Home Page accessible via
the USQ
This is important!
The course web page described above is your primary point of
contact with the university for this course. You can submit assignments via this site, and also retrieve results and feedback.
You are required to complete three (3) assignments and an examination.
Details of due dates and weighting appear in the Table below and in the
assignment specifications later in this book. The course specification can be
accessed via the course home page.
As there are 3 assignments you must complete them in a timely manner. In
particular, you must ensure that you install Linux early in the semester so
that you can proceed with the assignments.
What and how to hand in
All assignments are to be submitted in an electronic (not paper) format.
On-campus students must submit assignments via EASE on your StudyDesk.
External students are allowed to use a CD-R disk to do so if and only if
online submission is not possible.
The ‘submissions’ page contains complete instructions for submitting an
Before the due date, you will be able to submit an assignment via EASE as
often as you like. A newer submission overwrites the older one, hence only
the most recent one will be marked. Penalties will apply for late submissions
(see the course specification).
c University of Southern Queensland

8 CSC2408—Software Development Tools
As an alternative
for external students only, submit files on a CD-R,
using normal mailing procedures. The Linux tool for generating an ISO9660
filesystem (the filesystem found on optical disks) and burning it to disk
Do not submit via email. Submissions via email will be ignored!
Each assignment consists of completing a number of questions. Typically
you will be asked to hand in either or both of the following:
A text file showing that you have executed correctly the commands or
programs that are described in the exercises.
One or more program files or scripts (e.g. makefile, Bash script, Latex
source or output).
Here is a good way of creating the assignment text file (the first of the two
items above).
This is especially recommended for the first assignment.
Have two terminal or windows open on your screen. One is a standard
window used to type in the commands and inspect the result. The second
one contains an editor session. Now try out the commands needed for the
assignment in the first window; when you get it right highlight (click and
drag the left mouse button) the command and its response. Then paste into
the editor session using the middle mouse button. If the text you want to
highlight is longer than a screenfull either copy and paste a screenfull at a
time or do the following to highlight it (we assume a three button mouse)
before a single paste operation.
Scroll up in the window using the middle mouse button while pointing
at the scroll bar.
Highlight the initial part of the text by click and dragging with the
left mouse button.
Scroll down to the end of the text to be selected.
Extend your initial selection by click and dragging the right mouse
How to Lay Out Assignments
Suppose A Question in an Assignment is What is inode?, your answer to it
should indicate clearly which question using some suitable marker like
c University of Southern Queensland

CSC2408—Software Development Tools 9
+ Question 3
inode is a data structure that contains information about a file.
An inode for a file contains the file’s length, the times the file
was last accessed and modified, ……
It is vitally important that your assignment is clearly laid out.
It must be a straightforward matter for the examiner to determine that you have completed each question satisfactorily. We
want quality not quantity. Poorly organized submissions will be
Assignment Results and Feedback
Assignment results will be posted on your StudyDesk.
It is your responsibility to check the assignment link regularly to
determine your result.
If you submit via a CD-R (external students only), the results will also be
returned by normal post (snail mail!).
c University of Southern Queensland

10 CSC2408—Software Development Tools
Course Support
Support for this course is available for all enrolled students. The main
avenues for help, in order, are
The discussion forums on the course web pages. Any query posted
to the course forums should be answered by anyone who can. It is
not just to be a forum for the lecturer of the course but as a general
communication forum for all the students in the course.
If you need to communicate to the examiner of the course then send
email via message facility available on the course web pages.
You can also communicate to the lecturer of the course via Ask USQ
– from the homepage: UConnect > UAsk > Ask USQ.
If you have a specific Linux question you can contact the lecturer or
send email to
[email protected]
Study Desk
Your StudyDesk in UConnect gives access to a home page for every course
in which you are currently enrolled. Content available from the course home
page will vary according to the teaching requirements of the course, but may
course materials and resources,
electronic discussion facilities,
access to past examination papers.
As each course has specific learning requirements, availability of these features will vary between courses.
UConnect gives access to the Library and the Academic Learning Support
site, as well as the Quick Links list of University sections and services.
c University of Southern Queensland

CSC2408—Software Development Tools11
Study Schedule
The following table contains a recommended study pattern which will see
you handing in all there assignments on time.
The first five weeks are probably a little easier than the later weeks. This
allows you plenty of time to get used to Linux, which you must do as soon
as possible. Weeks 6–8 will be pretty hard going, as other assignments will
be no doubt due as well during this period.
If at all possible you should try to “get ahead” of this schedule. For instance,
try and finish assignment 1 early, and then make a start on assignment 2 as
soon as possible. This also applies to assignment 3, as there is little time
between handing in assignment 2 and when assignment 3 is due.

Week Module Topics Assignment
1 M1 Linux OS
2 M2.1–2.4 Unix commands
3 M2.5–2.8
4 M2.9–2.10
5 M2.11–2.12
6, 7 B R E A K A1 Due (see course spec)
8 M3 Bash
A2 Due (see course spec)
12 M4 Configuration
14 M5 Document
A3 Due (see course spec)
16 E X A M I N A T I O N S
17 E X A M I N A T I O N S

c University of Southern Queensland
12 CSC2408—Software Development Tools
Assignment 1
Weight 15%
Due Date See course specification
It is compulsory to use either vi or emacs editor to edit your
submission, the submission containing all answers must be in a
single text file.
Question 1. (6 marks)
Study the following filenames which contain wildcards.
Give three examples of filenames that would match each of the following wildcard patterns:
Give three examples of filenames that would not match each of the
above wildcard patterns.
Question 2. (6 marks)
Assume that a file’s permissions give you read and write access.
What operations can you perform on the file if it is in a directory
which has “r” (read) only access?
What operations can you perform on the file if it is in a directory
which has “x” (execute) only access?
Question 3. (6 marks)
When the shell is reading the command line what is the difference between
text enclosed between double quotes (”) and text enclosed between single
quotes (’)? Consider two cases.
c University of Southern Queensland

CSC2408—Software Development Tools13
there are environmental variables and
there is no environmental variable.
Question 4. (8 marks)
Provide English description for the regular expressions listed below.
(For instance, the regular expression “x*$” could be described as “zero or
more x at the end of a line”.)
Question 5. (8 marks)
Give the command-line of using find to list all the files having specific
username in the current directory
Give the command-line of using find to list all the subdirectories in
the current directory
Use find to produce a long ls listing of all files in /usr/bin that are
more than 750Kb long. Give all the arguments and options in the
following command-line
find ….. -exec ls -l {} ;
Note that pay special attention to the arguments or options. The
semicolon must be escaped, but not the
Question 6. (8 marks)
Create a big file (If you don’t know how to create a big file, try ls -l
/usr/bin > bigfile
). Create two copies of it using cp, and call them
big1 and big2.
c University of Southern Queensland

14 CSC2408—Software Development Tools
Give the command-line of compressing big1 using gzip (should produce big1.gz).
Compress big2 using bzip2(should produce big2.bz2).
Give the command-line of comparing the sizes of the compressed files
big1.gz and big2.bz2) and the original (bigfile) using ls -l
Give the command-line of checking the file type of compressed files
and the original.
Give the command-line of displaying the contents of big1.gz using
zcat and big2.bz2 but using bzcat without uncompress them. (You
may pipe the output to
head -10 to avoid lots of output).
Question 7. (8 marks)
Use tar to create an archive (don’t use the z or j option) of all the
files in the current directory.
Compress the tar file with gzip.
View the contents of archive with
gunzip -c gzipped-tar-file | tar tfv –
View without using gunzip but use the tar instead. (Hint: find the
right option to use from the man page).
Create a subdirectory of the current directory.
Use tar to unpack the archive into that directory at the current directory.
Question 8. (10 marks)
Assume you have a text file called file. Explain the following commandlines.
1. sed “s/the/a/g” file
2. sed -n “s/[A-Z]/&/gp” file
3. sed “32,45 s/[()]//g” file
4. sed “/^$/d” file
5. sed “s/([0-9])-([0-9])/12/g” file
6. sed “80q” file
For example, sed ’s/fox/ox/g’ file will replace all occurance of fox with
ox and not the just the first one in file.
c University of Southern Queensland

CSC2408—Software Development Tools15
Assignment 2
Weight 15%
Due Date See course specification
Submission instructions:
Your submission should be a single archive file, and preferably
compressed as well, which contains the following 5 files :
A text file contains the script for question 1.
A text file contains the answer for the question 2. (Hints: to
fully understand the script, you are advised to type in the
given script using vi editor, and make it executable and test
A text file contains the answers for question 3.
A workable makefile for question 4.
A text file contains all the RCS commands you use for question 5.
The utility to use is
tar ass2.tar file1 [file2 …]
Question 1. (10 marks)
Write a well structured Bash script to delete comments from a C program. In
Bash script, you may use
sed commands or other Linux utilities. A standard
comment line in C programs starts with the two-characters token (
/*) and
ends with the two-character token (
*/). Assume that each comment line
contains the start and end tokens without any other statements before and
after. You need to pay attention to the following cases:
/* a comment line in a C program */
printf(“It is /* NOT a comment line */n”);
x = 5; /* This is an assignment, not a comment line */
[TAB][SPACE] /* another empty comment line here */
You can test your Bash script on a C program containing all above four
c University of Southern Queensland

16 CSC2408—Software Development Tools
Question 2. (15 marks)
A Bash script is given as follows.
#A script demonstrating an until-loop and command line processing
# List the regular files of a directory greater than a given size
Usage=”Usage: $name [-h] [-s N] [directory]”
if [ $# -eq 0 ]; then
echo $Usage
exit 1
until [ $# -eq 0 ]
case $1 in
-s) shift
-h) echo $Usage
exit 0;;
*) directory=$1
if [ ! -d $directory ]; then
echo “‘$directory’ is not a directory”
exit 1
if [ $size != ’’ ]; then
arg=”-size +$size”
find $directory $arg -type f -exec ls -l {} ’;’
c University of Southern Queensland
CSC2408—Software Development Tools17
Carefully look at it. Add comments to this script — line by line.
Question 3. (10 marks)
In the makefile below which has some implicit rules, first identify all of:
construction commands
Then replace the implicit rules by the explicit rules.
COBJECTS = menu.o users.o resellers.o propspects.o
HFILES = menu.h
leads: $(COBJECTS)
gcc -o leads $(COBJECTS)
menu.o users.o resellers.o prospects.o: $(HFILES)
Question 4. (15 marks)
Suppose there are two C source (transaction.c and reports.c) and two header
files (trans.h and reps.h). Write explicit rules for a
Makefile/makefile that
reflects the following relationships:
1. The C source files
transaction.c and reports.c are compiled to
produce an executable
transaction.c and reports.c include a header file accts.h
3. The header file accts.h is composed of two other header files: trans.h
and reps.h.
c University of Southern Queensland

18 CSC2408—Software Development Tools
Assignment 3
Weight 10%
Due Date See course specification
Submission Instructions:
Submit a single tar file, preferably compressed, which contains:
A single text file contains the script for question 1.
A set of LATEX files as suggested in question 2.
A LATEX file as suggested in question 3.
Question 1. (10 marks)
Write a short but well structured Bash script that, given the name of a file
as an argument, reads the file name and creates a new file containing only
those lines which have one word in it. Here is an example of the input file.
This is a special text file
are 20 students in the class.
[TAB][SPACE] Nearly
half of them are enrolled in FoS. The rest are in
The output file from the script should look like
[TAB][SPACE] Nearly
Ensure the script has error and robustness checking.
Question 2. (10 marks)
Use a small text file to experiment with the RCS system. Note that RCS
treats all ASCII file the same way; the files do not necessarily be programs,
though usually are programs. Specially you should
c University of Southern Queensland

CSC2408—Software Development Tools19
Place a $Log$ keyword in the file
Complete a set of check in operations which result in the RCS file
structure depicted in Figure
Figure 1:
You will need to make small changes to the source file between check
in operations.
Associate a symbolic name with revision
Make the branch containing revision the default branch
Use rlog to verify the RCS structure.
Give all the command lines used in each step along with a brief description.
Question 3. (10 marks)
You need to submit two separate LATEX documents.
Create a short (less than 1 page) LATEX document. It should be in
11point font, and contain at least one section and subsection. Include some text in
typewriter font, italics, SMALL CAPS and bold.
(Please save the document as
ar0.tex )
Expand the document as follows. (Please save the expanded document
ar1.tex )
c University of Southern Queensland

20 CSC2408—Software Development Tools
1. Add a title with your name and the date
2. Include at least two forms of list
3. Include a piece of verbatim text – this might be a program or a
program fragment.
4. Experiment with font size: try out all (at least 4) the available
font sizes and include the results in your document.
Ensure the L
ATEX document has an appropriate structure and LATEX tags
are in right order.
Question 4. (20 marks)
Expand the document: ar1.tex as follows. (save this document as ar2.tex)
1. Add a table of contents
2. Create a floating table with caption. It should look just like the one
in Table
??, except that the table number will be different(Don’t have
to use the multirow package).

Category Tool
Command Description
Editor emacs
Emacs extensible text editor
Visual editor
Scripting bash
GNU Bourne-Again SHell
Practical Extraction and Report Language
Revision Control System
Document Typesetting Package
Managing Project Utility

Table 1: Some Unix Utilities
3. Typeset the following formulae and add them to the document
x =
b ± √b2 4ac
4. Typeset the following mathematical formula (??).
x) =
1 if x > 0
1 if x < 0
0 otherwise
c University of Southern Queensland