Abc Assignment Help

CSI6204 Scripting Languages: Portfolio Assignment 2 Task 1 Answer

Scripting Languages: Assignment 2.1- Portfolio Task 1


In this assignment you are required to write four (4) scripts that will demonstrate the extent to which you have understood the shell scripting concepts and practices addressed in Modules 1 to 5 inclusive. Each task is worth five (5) marks for a total assignment value of 20 marks. These portfolio tasks will help you build capacity for implementing the final main assessment.


  • Your script will be marked on a standard Linux installation using the bash shell.
  • You must only use bash shell script as covered in lectures and workshops.
  • Refrain from using non-core commands, tools and utilities in your bash shell scripts. Non-standard bash commands, tools and utilities will not be downloaded and installed by your tutor.
  • Ensure each script you write is fully self-contained and is not configured to be dependent on external files, libraries or resources to run.
  • Do not use the trap command in any of your scripts.
  • Each script you submit must contain your full name and student number at the beginning as code comments.


  • This is an individual assignment only and must not be completed in collaboration with other students
  • You may not work with others, acquire code from others, or provide code to others
  • Further, you may not post any of the assignment tasks below to a code-development community of any kind seeking solutions or advice
  • Nor may you copy and paste or otherwise reproduce code provided by external sources and use it as part of your own solutions
  • Where it is found that any of these restrictions have been ignored, academic misconduct proceedings may be initiated
  • Please read the checklist below and watch the associated video BEFORE submitting your assignment

Task 1 (5 marks)

Write a script that calculates the sum of three (3) integers passed to it through the command line.


  • Call the script
  • When the script is run, any three (3) integers will be used by your tutor when the script is run on the command line, e.g. ./ 5 10 12. These are example values only, so do not hard-code these into your script. Your tutor will use different values when marking your script.
  • The output of the script to the terminal will appear as follows:

The sum of x and x and x is x

where represents the integers passed to the script when it is run and their calculated sum

  • Your script will terminate once this has been done.
  • Your script must use bash default variables to hold the passed integers and as arguments in the sum calculation. You may only create a custom variable for the sum of the integers.
  • There is no need for data validation in this script; your tutor will enter three (3) integers as required when the script is run.

Task 2 (5 marks)

Write a script that when run, prompts the user to enter a two digit numeric code (integer) that is no less than 20, and no greater than 40.


  • Call the script
  • The value input by the user must be validated to ensure that:
    1. It is an integer
    2. It is within the range specified
  • In the event that the input entered by the user is invalid, they are to be advised of such and prompted to try again.
  • In addition to entering valid values, your tutor will test your validation by also entering:
  • Integers outside of the stated range, e.g. 1941
  • A string, e.g. helloworld
  • A null value (by just pressing enter)
  • Your script must detect and reject these invalid inputs and prompt the user to try again.
  • The input process must continue until a valid two digit numeric code is entered. Do not allow the script to terminate until a valid two digit numeric code has been entered by the user.
  • Once a valid two digit numeric code has been entered by the user, echo a message to the screen that a valid input has been made and then terminate the script at this point.

Task 3 (5 marks)

Write a script that counts the number of files and directories within a given directory according to their properties.


  • Call the script
  • When the script is run, the path to a directory will be used by your tutor at the command line, e.g.

./ ~/CSI6203/backups/june2020. This is an example path only, so do not hard- code it into your script.

  • The output of the script to the terminal will appear as follows:

The [dirname] directory contains:

files that contain data

files that are empty non-empty directories empty directories

where [dirname] represents the directory of your tutor’s choosing and represents the number of files and directories found matching each criterion.

  • Be sure that the script can be run from any directory it is placed in within your tutor's Linux user directory structure.
  • There is no need for data validation in this script; your tutor will enter a full path/directory that does

exist and within which a range of files and directories also exist.


For solution, connect with our online professionals. 

Customer Testimonials