Scripting Languages
Assignment 3: Software-based Solution (Script & Video)
ASSIGNMENT BRIEF
Important points before you begin:
-
Read this brief very carefully in full, and at the earliest opportunity
-
If any of this brief’s stipulations are unclear to you, it is your responsibility to seek timely clarification from the lecturer/unit coordinator well before the assessment’s due date
-
Be aware that if you misinterpret this assignment brief, either in part or in full, this misinterpretation will not be accepted as grounds for an appeal of the result allocated
Overview
In this assignment you will be required to write a script that demonstrates the extent to which you have understood the shell script (bash) commands, programmatic techniques and concepts addressed in Modules 1 to 8 inclusive. This assignment is worth 20% (20 marks) of your unit grade and its completion will help you build the remaining skills required for the final assignment to follow.
General Assignment Requirements
-
▪ Your script will be run in the Azure Linux VM provided at the beginning of semester. It is expected that you will develop and test your script in this Azure environment to ensure full compatibility.
-
▪ Your script must be a bash script and nothing else, i.e. the shebang line used is #!/bin/bash. Scripts of any other type, e.g. #!/bin/sh will receive a grade of zero (0).
-
▪ Ensure the script you write is fully self-contained and is not configured to be dependent on external files, libraries or resources to run. Non-observance of this requirement may cause your script to run incorrectly or not at all.
-
▪ Carefully check your submission before uploading it to Canvas. What you submit is what gets assessed! If you make a submission error, e.g. submit a wrong file, an empty .zip archive etc, no further/subsequent submissions will be accepted, which may result in a substantial loss of marks, or even a zero (0) result in some cases.
-
▪ You must only submit a single shell script (.sh) file named logparser.sh contained within a .zip file with the stipulated name in any individual upload action. Do not upload multiple files/zip archives in the same upload action as all will be considered invalid and will not be assessed. Also note that only the most recent individual submission made (as determined by the timestamp Canvas allocates) will be assessed.
-
▪ If your script does not run for any reason, e.g. hard-coding of files/directories/paths, use of a development environment not compatible with the Azure Linux VM provided at the beginning of semester, only a partial mark may be awarded on a code-readthrough basis at the assessor’s discretion. Your assessor will not fix non-functional, dysfunctional or incompatible scripts.
Page 2 of 5
Task – Log Parser Pro (Script) [30 marks]
Using only the commands, utilities and programmatic techniques addressed in lecture slides 1-8 inclusive, write a script that, in addition to the functionality provided by logparser.sh (as developed for Portfolio 2), also offers the following functionality.
-
Prompts for the log file name and output file name (as applicable) instead of requiring that these be provided as command line arguments when the script is run.
-
Offers a set of three (3) command line options (flags) that enables filter functionality that:
o Returns (filters) only those rows that contain a single matching search term provided by the
user
o Returns (filters) only those rows that contain both of two matching search terms provided by the user
o Allow a generated results file to be compressed into a zip file • These three (3) command line options (flags) are to be:
o For a single search argument: -s arg, e.g., logparserpro.sh -s POST
o For a double search argument: -d arg,arg, e.g., logparserpro.sh -d POST,200
o A-zzipoption,e.g.logparserpro.sh-sPOST-z
-
Be aware that the -z flag cannot be used in the absence of either the -s or -d flag, i.e. logparserpro.sh -z is not valid
-
When the user chooses the -z option, the name of the zip file must be the same as that of the filtered results .csv file, e.g. results_file.csv -> results_file.zip
-
The output .csv file name must be:
o Created and named by the script, and not the user
o Totally unique in every instance, i.e. a newly created results output file must not overwrite or clash with an already existing results output file
-
The number of matching rows is also to be indicated in the terminal output
-
Importantly, full validation must be applied to all possible user inputs both at the command line and at the user prompt to ensure that the script does not attempt to commence processing based on invalid data/values
(See the demonstration video that accompanies this brief to see the lecturer’s solution in action)
Other Compulsory Requirements
-
▪ Call your script logparserpro.sh
-
▪ Your full name and student number must be placed at the top of your script (as comments) immediately after the shebang line.
Page 3 of 5
-
▪ To construct your script, use a carefully considered combination of commands, utilities and programmatic techniques sourced from Lectures 1-8 inclusive. Do not use bash/shell script commands, utilities and programmatic techniques not addressed in Lectures 1-8 inclusive as this will result in a lower mark (see rubric for details).
-
▪ Your script must contain concise ‘in-situ’ comments that accurately explain all of the code elements it contains in your own words. Note: Comments that are not relevant and accurate in regard to the code they describe, or a complete lack of comments, will not only cost marks, but may be viewed as suggestive of possible academic misconduct. [IMPORTANT NOTE: AI-generated comments will receive a mark of zero (0)]
-
▪ The efficiency and correctness with which the commands, utilities and programmatic techniques within your script have been utilised will also form a significant part of your mark, so please pay close attention to this aspect of your code as well. For example, your logparserpro.sh script is expected to make use of appropriately selected and correctly applied commands and command options, command line option management, conditional testing, loop structures, regular expressions, piping, command substitution, redirection, and functions amongst others. The total lines-of-code your script employs will also be considered, with deductions applicable should this significantly exceed the total deemed necessary to achieve the stipulated outcomes. The most common reasons for excessive lines-of code include, but are not limited to, poor command selection, non-use/poor use of functions, limited use of piping and limited/no use of command substitution.
Test Files
Continue using the original.csv file you were provided for use with your Portfolio 2 assignment.
Important Note:
As was the case for Portfolio 2, your assessor will not use the original.csv test file for the marking process so do not hard code it into your script. The input .csv file your assessor uses for assessment will be precisely the same as original.csv in every respect except it will:-
Have a different name (but will still have the .csv file extension)
-
Contain a different set of values (different set of records, but with the same column structure)
-
It will contain a different number of rows (it won’t be 500 rows as is the case for original.csv)
Further, your assessor will not use the name processed.csv for the output file name when your script is used in default mode, but rather, something unique (but will still have the .csv file extension).
It’s very important that you understand these statements about the test files provided, and seek timely clarification if you do not!
Assessment Rubric
On Canvas.
How to submit your portfolio to Canvas
Submit a single shell script (.sh) file named logparserpro.sh contained within a .zip file to Canvas with thefollowing naming format (use your surname/student number): [surname]_[student-ID]_CSxxxxx_ASS3.zip
Do not submit any files other than that stipulated above. Further, even though there is no restriction on how many times you make individual submissions (each of which gets its own unique timestamp in Canvas), do
-
Page 4 of 5
not upload multiple files/zip archives in the same upload action as all will be considered invalid and not be marked.
Task - Log Parser Pro (Video) [10 Marks]
Record a video presentation in which you present and explain the design and development processes you followed to develop your Log Parser Pro solution in the context of what you learned from the unit’s lectures and workshops. This presentation is to take the form of a ten (10) minute Panopto video, which addresses all of the following:
An Introduction [<= 1.5 minutes]
▪ Video begins with you appearing on-screen displaying your Student ID card (or DL/Passport) and verbally stating your full name and student number
▪ A brief overview of the presentation/demonstration is provided clearly identifying its purpose and a simple agenda of what is to follow
Main Discussion [<= 7 minutes]
-
▪ Explain the design and development processes you undertook to develop your Log Parser Pro solution, making specific reference to the shell scripting principles, techniques and commands addressed during the unit’s lectures and workshops
-
▪ Be sure to have your logparserpro.sh script up and running so you can demonstrate operationally where and how these principles, techniques and commands have been applied in practice to achieve the stipulated functionality outcomes
A Reflection [<= 1.5 minutes]
▪ Provide an explanation of the Log Parser Pro script’s development process that includes what went well, the difficulties encountered and skills and knowledge that have been gained from the process
Overall Presentation Values
▪ Both the video and audio elements of the presentation are of good quality
▪ The demonstration is given in a professional manner
Important Note: The functionality dimension of your script is assessed in the script component of this assignment, not the video component. If your script does not function correctly, or at all, when run by your assessor, the argument that it functioned correctly in your video will not be accepted.
Assessment Rubric
On Canvas.
How to submit your Assignment 3 video to Canvas
Using the process stipulated, submit your Panopto video through the appropriate section of Canvas on or before the due date specified.
END OF ASSIGNMENT BRIEF
Page 5 of 5