CS1101: Laboratory 6(b)

A useful shell script - usage

Academic Year 2006-2007

Lecturer: Dr. Barry O'Sullivan
Department of Computer Science
University College Cork

b.osullivan@cs.ucc.ie


Objective of this Lab

To familiarise students with the concepts of shell scripts.

This lab is based on material from Paul Andersen's book entitled "Just Enough UNIX".


Submission

During this lab you will be asked to write 1 shell script of your own. It must be submitted by 5pm Friday the 8th of December (Friday of this week).


Background

All shell scripts that you write, for this course, should be based on the sh shell. A reference on this shell is available online.


Tasks

You should write and submit a shell-script that meets the following specification.

Computing the size files or directories

You are required to write a shell script called usage which has the following specification:

Example:

bash> usage Mail
Mail is a directory
It's total size is 100kb
Contents:
cs1101 (file) 10kb
friends (file) 100kb 
backup (directory) 110kb
bash>
bash> usage usage
usage is a file
It's size is 4kb
bash>

Submission

Submit your script using the following command:

cs1101submit usage
You're all done!


b.osullivan@cs.ucc.ie

Return to the CS1101 Home Page