Question
1. Write a shell script that displays the following menu items, prompt the user to enter a selection, and then executes the command associated with
1. Write a shell script that displays the following menu items, prompt the user to enter a selection, and then executes the command associated with that menu item. If required, prompt the user for additional commands should the menu item require it.
The menu items:
(a) Display a list of files and directories in the current directory
(b) Display a long list of the contents of the current directory
(c) Display a list of the last n messages in /var/log/messages, prompting for the value of n
(d) Display the contents of this script
(e) Display the contents of this script in reverse
(f) Exit the script Dont forget to have the script keep running until the user selects the exit option.
Linux keeps track of all log-in attempts in the file var/log/auth.log. Write a shell script that searches the contents of this file and displays any entries where a user logged onto the system as the administrative user (that user will have user name of root and a uid of 0).
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