Question: Write a bash script that performs the following steps: Prompt the user for a directory name, verify that the directory exists, and navigate into that
Write a bash script that performs the following steps:
Prompt the user for a directory name, verify that the directory exists, and navigate into that directory. If the directory does not exist, allow the user to create it
List all the files and subdirectories in the directory and display a menu to the user to select a file or a subdirectory.
If a file is selected:
a Display the first ten lines of the file.
b Ask the user if they want to display more. If "yes", display the next ten lines.
c Continue this process until the user responds with no or the end of the file is reached.
If a subdirectory is selected:
a navigate into that subdirectory.
b Perform a recursive search to find all files that have been modified in the last hours.
Present a list of these files to the user and ask them to select one.
For the selected file, repeat the file display process as described in step
After the operation is completed for either a file or subdirectory, return to the main menu to allow the user to select another file or subdirectory, or to exit the script.
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
