Question: This is an individual assignment. You must submit your own work and you are solely responsible for your submission. Make sure you understand what are
This is an individual assignment. You must submit your own work and you are solely responsible for your submission. Make sure you understand what are required for each question. There are questions in this assignment.
This assignment will contribute towards your overall course marks.
Question : Shell Scripting Max Mark:
This question requires you to write a shell script for bash or zsh
Task: Write a bash or zsh shell script that accepts exactly two arguments from the commandline. The first argument is meant to be a filename of a text file and the second one is the name of a directory. This script should perform the following:
a Display an appropriate error message and terminate if the number of arguments is not exactly
b If the file specified in argument does not exist, then display an appropriate error message and terminate.
c Otherwise, save all the lines in that file that contains the word special in a file called special.txt in the directory specified as argument If this directory does not exist in the current directory, then create it
d If the file special.txt already exists in the directory specified, then those lines of text extracted from argument should be appended to special.txt
Submission Requirement: Submit only your script file. Your script file MUST be named extract.sh
Your script file should be documented with appropriate comments. Make sure your name and student ID are at the top of the file.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
