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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!