Sie sind auf Seite 1von 8

COMP-10024 : Fundamentals of UNIX

Lab 15 : Shell Scripting, Lab Assignment 2


Lab Procedures Write a (bash) Shell Script which satisfies the following specifications. See Script Snapshots section for layout, script operation, messages, process errorlevel test procedures, etc

Filename: Lab_15.sh Script must include the Statement of Authorship. A grade of zero (0) will be assigned to any lab submitted which does not include the Statement of Authorship in the script header section. Any offence as outlined in Mohawk Colleges Academic Dishonesty policy will be pursued to the maximum penalty Make of copy of your Lab_14.sh and use it as a base for this lab. Accepts exactly (4) command line arguments for the script to function properly o Any more or less arguments cause a usage message to appear with an appropriate error/message statement o Exactly (4) command line arguments cause the printout of those arguments to appear o Keeps the user locked into the menu, using the while/do/done looping construct, until the appropriate menu choice is entered o Makes use of the case/esac branching construct to process the menu options

Submission Procedures Submit your solution before the deadline on eLearn. Include your student number and lab number in the zipped up file name, like this

Format: <student_number>__Lab_15.zip Example: 000123456__Lab_15.zip

Deadline: See your instructor for deadline. Late labs receive a mark of zero. *** Keep a copy of your script. The last lab builds upon this script ***

Page 1 of 8

COMP-10024 : Fundamentals of UNIX

Marking Scheme Total Marks: 100 Breakdown of Marks Appropriate Script Header, including a description (understanding) of what the script does [5 marks]

Embedded commenting [5 marks] o For major sections within script o Not for every line Appropriate and Consistent Spacing (layout) [15 marks] Script Details (specifications) [30 marks] Screen input/output (layout) [15 marks] Interpolation of Variables (dynamic scripting) [10 marks] Procedural Layout (correct flow of statements) [10 marks] Script Execution (functionality) [10 marks]

Required Errorlevels Errorlevel # 0 10 11 12 13 14 15 16 17 18 19 Event Information Script functions correctly No arguments provided on command line (=0) First argument missing (=0) First argument present, but not what expected (-i) Second argument missing on command line Second argument present, but file does not exist Third argument missing on command line Third argument present, but not what expected (-o) Fourth argument missing on command line Too many arguments provided on command line (>4) Overwrite file is declined (n), and script exits without going to the menu

Variable Interpolation The script must be as dynamic as possible. Variables are to be used for command line arguments, user input, and generated output throughout the script. Hard-coded values, where variables can be used, are unacceptable. Script Snapshots Description: Script is executed properly with exactly (4) command line arguments.

Page 2 of 8

COMP-10024 : Fundamentals of UNIX

Description: If the output.txt file does not exist, then the user is presented immediately with the Main Menu. The user is kept locked into the menu interface, until option # 5 is entered. The while/do/done looping construct is to be used to achieve this. Each menu item is processed using the case/esac branching construct.

Description: Each menu option is process, and for now, a simple unique statement is echoed to the screen.

Page 3 of 8

COMP-10024 : Fundamentals of UNIX

Description: Each menu option is process, and for now, a simple unique statement is echoed to the screen.

Description: Each menu option is process, and for now, a simple unique statement is echoed to the screen.

Page 4 of 8

COMP-10024 : Fundamentals of UNIX

Description: Each menu option is process, and for now, a simple unique statement is echoed to the screen.

Description: Each menu option is process, and for now, a simple unique statement is echoed to the screen. Menu option # 5 is functional, and will exit the user back to the shell prompt, with the appropriate process errorlevel value.

Page 5 of 8

COMP-10024 : Fundamentals of UNIX

Description: User is returned to the shell prompt upon a successful exit, and after clearing the terminal window.

Description: Test procedure for an errorlevel value of zero (0).

Page 6 of 8

COMP-10024 : Fundamentals of UNIX

Description: Test procedure results for an errorlevel value of zero (0).

Description: Test procedure for an errorlevel value of that is non-zero (>0).

Page 7 of 8

COMP-10024 : Fundamentals of UNIX

Description: Test procedure results for an errorlevel value of that is non-zero (>0).

Description: Test procedure results for an errorlevel value of that is non-zero (>0).

Page 8 of 8

Das könnte Ihnen auch gefallen