Answered step by step
Verified Expert Solution
Question
1 Approved Answer
For this assignment you are to create a Bash script that continuously displays a main menu. The main menu will run in a terminal
For this assignment you are to create a Bash script that continuously displays a main menu. The main menu will run in a terminal window. Ideally this menu should not exit, however an exception can be made. An example of the main menu is provided below. The menu will allow users to start applications and view log files. The user does not have to know how to execute applications from the command prompt. They have to select it from the menu and the script will start the application in the background. Main Menu Listing 0. Exit (this option can be hidden from display to user) 1. Process Management... 2. Terminal 3. Process Viewer 4. Text Editor 5. Web Browser 6. Logs... The main menu has four applications. It is important that the applications be started in the background. This is applicable for GUI based applications such as Terminal, Process Viewer, Text Editor and Web Browser. The commands for these applications can be found in the table below. Applications and their binary executables Application Terminal Process Viewer Text Editor Web Browser Binary executable gnome-terminal gnome-system-monitor gnome-text-editor firefox In the main menu listing we can see "Process Management" and "Logs". These are sub menus. The two submenus (Process Management Menu Listing and Logs Menu Listing) can be found below. Note that there is an option to return back to the main menu. Process Management Menu Listing 0. Back to Main Menu 1. Running Processes 2. Processes Displayed in Long Format 3. Processes Displayed in BSD Format 4. Display Process Tree without Threads The Process Management Menu Listing is responsible for allowing a user to choose how "ps" and "pstree" commands will be executed. This means that in each case these commands will have a different set of arguments used. In order to identify the best set of arguments, man pages may have to be used. Logs Menu Listing 0. Back to Main Menu 2. 1. Recent dmesg messages Recent kernel messages 3. Recent syslog messages The Logs Menu Listing is responsible for allowing a user to display recently logged messages. For this assignment recently logged messages can be simply defined by the last 20 messages or 20 lines from a log file. There are three log files: dmesg, kernel, and syslog. These log files can be found in /var/log folder. It is up to you how you organize your script. My recommendation is that you create a loop that iterates through the main menu. Each of the three menus can be coded in their own procedures. That is three procedures, one per menu.
Step by Step Solution
★★★★★
3.49 Rating (172 Votes )
There are 3 Steps involved in it
Step: 1
binbash while true do clear echo Main Menu echo 0 Exit echo 1 Process Management echo 2 Terminal ech...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