Threesuns

Email

Contact

All Semesters

Semesters

All Courses

Courses

Introduction to UNIX/Linux

CSCI1483

3 credits

Labs

Shell Scripting II

Lab

20 points

Requirements

Filename accepted as a command line argument2
Error expressed if no command line argument given2
File existence tested2
Error expressed if file does not exist2
Collection directory's existence tested2
Collection directory created if it didn't exist2
Specified file copied into the collection directory6
Comments included in code2
Total20 pts

Objective

To create a simple shell script

Instructions

Write a shell script called "collect" that will:

Accept the name of a file as a command line argument. If a command line argument isn't given, display an error message and quit.

If an argument is given, test to confirm that the argument is the name of a file in the working directory. If the file exists, copy it to a "collection" directory. If the file doesn't exist, display an error and exit.

The collection directory should be a directory called collection located below the current users home directory. Test for the existence of the collection directory and if it doesn't exist, create it before copying the file.

Document you program by adding comments to it and leave the script in your bin directory for grading.