KIT501 UNIX Scripting Assignment

Assignment Help Other Subject
Reference no: EM133139685

KIT501 UNIX Scripting - University of Tasmania

Learning Outcome 1: Apply industry standard techniques and skills to configure network infrastructure and operating system processes.

Working environment

On the teaching server, ictteach.its.utas.edu.au, you must make a directory named kit501script in your home directory and use this directory as your working directory for all assignment development.

1. The first time you start working on the assignment, after logging on, type the following commands ($ is the prompt, do not type that):

$ mkdir kit501script
$ cd kit501script

2. Every other time you log on, simply do the following and then continue working:

$ cd kit501script

Allowed Syntax/Commands

All scripts must be completed using syntax and commands discussed in past (and some future) practical classes - no additional referential syntax (that is not discussed in practicals) is allowed. This means your script solutions must not use alternative constructs and syntax e.g. solutions found through websites via google searches that use commands and shell syntax that we have not covered in the practical content, and you must not use external parties or other individuals to write the scripts for you (this is considered plagiarism and academic misconduct).

1 Assessment Process

All student script submissions will be marked by KIT501 tutors on ictteach according to the rubric on the last page of this document. If your scripts were developed elsewhere (i.e., not on ictteach) it's your responsibility to ensure that your scripts run correctly in our teaching environment. You will lose considerable marks if your scripts do not run correctly on our teaching server, so it is imperative you develop and test your scripts on ictteach before you submit.

Scripting Task

Overview

A researcher has used a logging program to log observations for an experiment. The output of the logging program is a series of log files in a directory that have the following naming format:

fileABCDEFGH

where file is literally the word 'file', and A..H are single binary digits (0 or 1).

The researcher did not realise for several weeks that the logging program's output filenames had binary digits, and, unfortunately, her further research work requires the filenames to be fixed to replace the binary part with the decimal number. The researcher also mistakenly added other files to the directory containing the log files, and these other files do not have the correct naming format. She wants you to write a script to rename the validly-named files, and then sort all the files in her directory into one of four subdirectories depending on their filename - the script must also output what files (and their associated 'category') are found.

Valid filenames
Any of the following would be considered potentially valid filenames produced by the researcher's logging program (all categorised as CATEGORY1) - a filename that starts with file followed by 8 binary digits:
• file00000000
• file00000001
• file00000010
• ...
• file11111111

Invalid filenames
Anything not fitting the pattern described above is invalid.
• CATEGORY2 - filenames that start with file that are followed by zero or more binary digits only (but less than 8 binary digits) e.g. file, file0101, file0000000
• CATEGORY3 - filenames that start with file that are followed by any characters that include non-binary digits e.g. filesort0101, file00112110, fileWRONG
• CATEGORY4 - any filename that does not start with file e.g. badfile, fire01001010

The researcher's request means your script must require an arbitrary directory name to be specified when it is run, after which it will then rename any valid filenames and move the files it finds in the specified directory according to the requirements that follow:

Task Requirements

1. Your script for this task must be named binarylog.sh
If your script has a different name, it will not be assessed.

2. Make sure your script is not unnecessarily complex - your script should use consistent indentation and include whitespace/blank lines (where relevant) to make the script more logical and easier for a person to read. You must also include general inline comments in the script code to indicate the purpose of more complex command combinations etc.

3. Your script must start with the following first line:

#!/bin/sh

(this specifies the shell to be used to interpret the rest of the commands in the script)

4. Your script must include comments at the beginning (near the top of the script) to specify:
a. the script's purpose,
b. the author (including student number),
c. and the date (when last modified).

5. One directory name must be supplied as an argument to be used by your script when it is executed by the user (the directory referred to would presumably be one that contains a mixture of validly named and invalidly named log files that are going to be processed by the script). The directory name must not be 'hardcoded' (written) in your script, i.e., its value must come from the command line argument. If no directory name is provided by the user, the script should provide a usage warning message and then exit. See Example Output for an example.

6. Near the beginning of your script, you need to check that the directory associated with the directory name provided as an argument to the script:

a. Exists. If the directory does not exist, your script must display an error message and then it should exit. The directory name provided can use an absolute path, or a relative path - see Example Output for examples.

b. Is readable, writeable and executable.
i. If the directory is not readable, your script must display an error message and then it should exit.
ii. If the directory is not writeable, your script must display an error message and then it should exit.
iii. If the directory is not executable, your script must display an error message and then it should exit.

7. For every file in the specified directory, the script must:
a. For a validly named file:
i. echo the following output to the terminal screen:
ii. Rename the file with its specific filedecimal name and then move it to a
subdirectory called CATEGORY1 (the script should only create the directory here if it does not already exist and also only when a file in this category is found). See the section Binary to Decimal Renaming below.

b. For an invalidly named file that starts with file and is then followed by less than 8 binary digits (and no other characters):
i. echo the following output to the terminal screen:
ii. Move the invalid file to a subdirectory called CATEGORY2 (the script should
only create the directory here if it does not already exist and also only when a file in this category is found).

c. For an invalidly named file that starts with file and is followed by any characters that include some non-binary digits:
i. echo the following output to the terminal screen:
ii. Move the invalid file to a subdirectory called CATEGORY3 (the script should
only create the directory here if it does not already exist and also only when a file in this category is found).

d. For an invalidly named file that does not start with file:
i. echo the following output to the terminal screen:

ii. Move the invalid file to a subdirectory called CATEGORY4 (the script should only create the directory here if it does not already exist and also only when a file in this category is found).

8. If the command-line argument specified directory contains no files:
a. echo the following output to the terminal screen:

b. exit the script

This also means if you run the script twice, the first time should process any files, displaying the outputs specified in requirement 7 above, renaming where appropriate, and moving files to specified category subdirectories. Running the script for a second time (with the same directory argument) will produce the output specified in this requirement (requirement 8), as all files should have already moved to subdirectories. Your output should never "process" or mention the subdirectory names.

Binary to Decimal Renaming

As previously mentioned, a validly named file will have the form fileABCDEFGH, eg file01010111

Your script must implement an algorithm only using commands and syntax as discussed in practical classes. Your solution is restricted (i.e not allowed) to use the shell "builtin" conversion
e.g. echo $((2#101010101))

This restriction also extends to any other command that has not been discussed in classes - the following list shows some of the common methods (but not all) found through a brief google search - none are permitted:
awk sed printf xxd od perl ibase, obase and bc

Instead, your solution must take an iterative (looping) approach to demonstrate your understanding of iteration and selecting individual characters from a string (a string is just a sequence of characters).

Attachment:- UNIX Scripting.rar

Attachment:- ICT Teaching Server ictteach.rar

Reference no: EM133139685

Questions Cloud

Calculate theta cash surplus : Beginning cash balance $2,700. Based on the given information, calculate Theta's cash surplus (deficiency) for the month of October
Types of workplace hazards : What are some of the types of workplace hazards in yours (or someone you know), workplace? How is the company addressing the issue? (If they are.)
Managing occupational health-safety and environment : OH&S management system for an organization that you have worked in (or is knowledgeable about). You will need to identify the health and safety concerns in that
Calculate the required production in units of finished goods : Calculate the required production in units of finished goods for each quarter of the fiscal year and for the year as a whole
KIT501 UNIX Scripting Assignment : KIT501 UNIX Scripting Assignment Help and Solution, University of Tasmania - Assessment Writing Service
Review the links in the announcement : Multinational corporations and the extraordinary advancement of 4IR have created challenges for unions. Discuss how one of the key technological advances listed
Example of a variable expense : 1. Which of the following statements is false? 2. A time log can be helpful
Development of operations strategy : Suggest the competitive priorities that the business used in the development of its operations strategy
What is the business objective : The Gryphon Sports Medical Group (GSMG) in Guelph, Ontario is considering hiring an aggressive collection agency to assist in collecting on past due accounts.

Reviews

Write a Review

Other Subject Questions & Answers

  Cross-cultural opportunities and conflicts in canada

Short Paper on Cross-cultural Opportunities and Conflicts in Canada.

  Sociology theory questions

Sociology are very fundamental in nature. Role strain and role constraint speak about the duties and responsibilities of the roles of people in society or in a group. A short theory about Darwin and Moths is also answered.

  A book review on unfaithful angels

This review will help the reader understand the social work profession through different concepts giving the glimpse of why the social work profession might have drifted away from its original purpose of serving the poor.

  Disorder paper: schizophrenia

Schizophrenia does not really have just one single cause. It is a possibility that this disorder could be inherited but not all doctors are sure.

  Individual assignment: two models handout and rubric

Individual Assignment : Two Models Handout and Rubric,    This paper will allow you to understand and evaluate two vastly different organizational models and to effectively communicate their differences.

  Developing strategic intent for toyota

The following report includes the description about the organization, its strategies, industry analysis in which it operates and its position in the industry.

  Gasoline powered passenger vehicles

In this study, we examine how gasoline price volatility and income of the consumers impacts consumer's demand for gasoline.

  An aspect of poverty in canada

Economics thesis undergrad 4th year paper to write. it should be about 22 pages in length, literature review, economic analysis and then data or cost benefit analysis.

  Ngn customer satisfaction qos indicator for 3g services

The paper aims to highlight the global trends in countries and regions where 3G has already been introduced and propose an implementation plan to the telecom operators of developing countries.

  Prepare a power point presentation

Prepare the power point presentation for the case: Santa Fe Independent School District

  Information literacy is important in this environment

Information literacy is critically important in this contemporary environment

  Associative property of multiplication

Write a definition for associative property of multiplication.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd