Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Purpose of This Assignment: Purpose of this assignment is to teach you about shell scripts with if structure. Write a shell script which performs the
Purpose of This Assignment:
Purpose of this assignment is to teach you about shell scripts with if
structure.
Write a shell script which performs the following tasks:
Your script should check whether the two files "names" and
"surnames" exist. If either one of them does not exist, your script
should abort with an appropriate error message.
Your script should check whether the number of lines in these files
are equal. You can use the wc command with appropriate
parameters to obtain the number of lines in a file.
Assume each line in file "names" contains a name, and each line in
"surnames" contains a surname. If the number of names and
surnames do not match; print which file has missing entries, and
how many. Then, if the number of names is greater than
surnames, print all names without a surname; otherwise print all
surnames which do not have a name. Print an appropriate
message if the number of lines in both files are equal.
Example:
Names
Ali
Ayse
Ipek
Veli
Output:
There are missing surnames.
The names without a surname:
Ipek
Veli
Surnames
Atak
Tutak
SUBMISSION
Submit your sh file as your assignment.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started