Question
Problem 5 - Bourne Shell Scripting (15%) Specification Given a directory, write a UNIX script named mychex that processes each ordinary file inside that directory
Problem 5 - Bourne Shell Scripting (15%) Specification Given a directory, write a UNIX script named mychex that processes each ordinary file inside that directory as follows: Check if each file is executable or not. If not then ask the user if it should be changed to executable. If the user responds with 'y' or 'Y' then change the file permission to be executable by the user/owner. Leave the file as is for any other response. After all files have been processed, display the detailed information of all the executable files in the given directory using \"ls -l\" for the user's verification. If the given directory is empty then there is nothing to be done and nothing will be displayed. Note: Assume that there are no sub-directories inside the given directory (so that we do not have to worry about whether mychex is recursive or not). How is a directory specified? If the user does not enter any command-line argument then the given directory is the current working directory. If the user enters one command-line argument then the given directory is the command-line argument. The directory name can be an absolute or relative path name. If the directory name is not valid (i.e., the directory does not exist), display an error message on the standard output and quit the program. If the user enters more than one command-line argument, consider only the first argument (even if it is an invalid directory name, which will cause an error message to be displayed and the program to terminate) and ignore the rest. Sample Inputs/Outputs Use the provided script mktmp to create a directory Temp with several files inside it for your testing. See file alloutput.txt for some examples of running the script mychex and for the message to be displayed in each scenario. Note 1: When we grade this program, we will use the \"grep\" command on your outputs to search for the names of the executable files (which are displayed by \"ls -l\") and check the file attributes for the executable status. Note 2: Use only the commands, control structures and utilities provided in the lecture notes and tutorial notes.
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