Question
(Question 3) Programs written in other programming languages can execute shell commands and scripts in a Linux environment. Complete the following shell script and C
(Question 3)
Programs written in other programming languages can execute shell commands and scripts in a Linux environment. Complete the following shell script and C program:
(a) Write a shell script to merge and sort the content of TWO (2) text files provided by the user. The content will be sorted in ascending order before being redirected to a new file. Prompt the user to provide the names of the text files to read and the name of the new file to write the output. The new empty output file will be created based on the file name given by the user. Next, append the name and the total number of words of this new file with the appropriate labels at the end of this new file itself. Finally, prompt the user to decide if the two input text files need to be deleted before ending the script.
(15 marks)
(b) Write a C program to execute the shell script from the question 3(a) above. Next, this program will run the Linux command to display the content of the script. Finally, the program will prompt the user to enter Y or y to restart the Linux system, or else just exit from the current program.
(10 marks)
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