Question: Task details You are required to write a Bourne Again Shell Script (bash) to manage a menu-driven program. When executed the user should be presented
Task details
You are required to write a Bourne Again Shell Script (bash) to manage a menu-driven program.
When executed the user should be presented with a menu with four (4) options:
- Print the following user information: the home directory, print files and folder in column format, user id, login shell together with the current date and time.
- Reads a set of numbers between 0 and 100 until a sentinel value is entered. Use the value -99 as the sentinel value to terminate the loop. The idea of a sentinel controlled loop is that there is a special value (the 'sentinel') that is used to say when the loop is done.
- Print out the average, highest number and the lowest number of the entered numbers, also list all numbers above the average.
- Exit the program.
Requirements
Your script must allow one of these options to be chosen at a time. The menu must be presented repeatedly, until the fourth option (exit) is chosen. An appropriate error message must be displayed if an invalid option is chosen.
Option 1: your script should list the specified environment variables - the home directory, print files and folder in column format, user id, login shell together with the current date and time.
Option 2: should read a set of positive integer numbers between 0 and 100 until a sentinel value (-99) is entered. It then display all the positive integer numbers entered.
Option 3: should list the average, highest and lowest number of the entered numbers as well as displaying all entered numbers that are above the average.
Option 4: should cause a graceful exit from the menu and the whole program.
Please do the above task with the requirement below:
- Make sure the code is well commented.
- Remember to make your script user-friendly and easy to read!
- A neatly formatted print-out of your bash shell scrip
- Appropriate and specific acknowledgments of help you received from people, books, journals, etc. for this assignment
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
