Page 1 of 1

Write a shell script (to run on the Bourne shell) that allows a user to view, add, or delete a setting in a configuratio

Posted: Fri Jul 08, 2022 6:36 am
by answerhappygod
Write A Shell Script To Run On The Bourne Shell That Allows A User To View Add Or Delete A Setting In A Configuratio 1
Write A Shell Script To Run On The Bourne Shell That Allows A User To View Add Or Delete A Setting In A Configuratio 1 (36.93 KiB) Viewed 74 times
Write A Shell Script To Run On The Bourne Shell That Allows A User To View Add Or Delete A Setting In A Configuratio 2
Write A Shell Script To Run On The Bourne Shell That Allows A User To View Add Or Delete A Setting In A Configuratio 2 (21.95 KiB) Viewed 74 times
Write A Shell Script To Run On The Bourne Shell That Allows A User To View Add Or Delete A Setting In A Configuratio 3
Write A Shell Script To Run On The Bourne Shell That Allows A User To View Add Or Delete A Setting In A Configuratio 3 (22.16 KiB) Viewed 74 times
Write a shell script (to run on the Bourne shell) that allows a user to view, add, or delete a setting in a configuration file (config.txt) that contains settings in the form variable-value. The following is an example of such configuration file: CE-/4/0c/abc HOST-Jawson HOSTTYPE-Bund LOGRAME- ORTYPE-solari PATE-/us/at/bin:/usr/openwin/bin:/bin: BRELL-//bin/sh TE-Australia/ Rabe VENDOR-a EDITOR- Your script for this task must be named setting.sh. For ease of use, your script must present a menu of operations that a user may choose from. After the user makes a selection and that the selected operation has been completed, the menu must be displayed again so that the user can make another selection. Validation check on user inputs is required (see the following sample output about this). In the beginning of your script you need to check to see whether the required configuration file (config.txt) actually exists under the current directory (if not, your script displays a message and then exits). Here is a sample output of your script. The 5 is the shell prompt. The items in italics are not part of the sample output. They are hints indicating how your script should behave. $/setting.ah 1. Add a Setting 2. Delete a Setting 3. View a Setting 4. View All Settings Q- Qult CHOICE: 1 (user input Enter setting (format: ABCD-abed): ser simply proses the EnterReturn key New setting not entered Ester setting format: ABCD-abed KOTOR () Invalid setting (Anelid setting and to containin Enter setting formats ARCO-abods EDITOR) The variable name of the setting is The variable value of the setting is Invalid setting. Hat To retrieve a riable mame before the sign, rench the expr conditi handling strings) Enter setting (formats ABCD-abodies (input) The variable name of the setting is: The variable value of the setting invi Invalid setting. Enter setting format: ABCD-abod): EDITOR-vi The variable name of the setting is: EDITOR Page 2 of The variable value of the setting is v Invalid setting. The first character of a variable name cannot be Enter setting for COFT EDATINGA Taky tigunt
Enter setting tomat ABC-abon The variable name of the setting The variable value of the setting is Invalid setting. The first sharacter of a variable name can be digit. Enter setting format: ABCD-abori The variable name of the setting New setting added. ******* 1. Add a Setting 2.Delete 3. View 4. View All Setting o-Quat Enter setting (omat ABC-b The variable name of the setting The variable value of the setting is: J Variable exists, changing the value of nating variables is not allowed. ******* Setting Setting Add a Setting 2. Delete eg 3. View letting 4. View All 10- QUEE CHOICE iter variables ETOR) ****** 1. Add a Setting 2. Delete 3. View 4. View All Settings - Qult EDITOR teng Setting Delete this setting tin? setting deleted (Hefuser's is the g 1. Add a Setting 2. Delete 3.View ating 4. View All etting 10- Tra- Setting ****** 1. At deting 2. Delete Setting 3. View Betting 4. View All Being - Qust CHOICE) HOST-Lan HOSTTYPE LOGRAM-a Us-abe ***MER *** L. Anda deting 2. Delate Secting 3. View Betting 4. View All Betting 0-OVIT (CHOICE IT-varin T /// [GOTYPE-solaria [PATH=///bit Prof
Delete this setting ty/mi? y feri Setting deleted (Houer, if users are the setting st 1. Add a Setting 2. Delete Setting 3. View a Setting 4. View All Settings Q- Qust CHOICE: 3 Enter variable name:USER1 (wer input) Variable does not exist, urscript to check thera variable exists or not) ***HENU*** 1. Add a Setting 2. Delete a Setting 3. View a Setting 4. View All Settings - Quse CHOICE: 3 (user int Enter variable na USER abe Requested setting displayed above. ****** 1. Add a Setting 2. Delete a setting 3. View Setting 4. View All Bettings Q- QUIE CHOICE:+faser int HOME-/u/so/abe HOST-Lawson HOSTTYPE-Bus LOGNAME-abe OBTYPE-solaris PATH-/ust/dt/bin:/ust/openwin/bin:/bint IPRINA 152-> SHELL-/usr/bin/t.cab 72-Australia/Tasmania USER-abc VENDOR- ***HEND *** 1. Add a Setting 2. Delete a Setting 3. View a Setting 4. View All Settings - Quae CHOICE: 5 user int Invalid ebolON. ****** 1. Add a Setting 2. Delete a Betting 3. View & Setting 14. View All Settings - quit CHOICE: user input (The running script is terminated. The shell prompt is displayed Page 4 of