Question: Please help me fix the two problems with this script. The two problems that need to be addressed are the following: 1. The input needs

Please help me fix the two problems with this script. The two problems that need to be addressed are the following:

1. The input needs to be case-insensitive

2. There should be three (3) different exit codes for the various conditions

Below is example output of the script.

tmoyer2@itis-3246:~/scripting-2$ ./5-interactive.sh Do you agree with this? [yes or no]: y Agreed tmoyer2@itis-3246:~/scripting-2$ echo $? 0 tmoyer2@itis-3246:~/scripting-2$ ./5-interactive.sh Do you agree with this? [yes or no]: YeS Agreed tmoyer2@itis-3246:~/scripting-2$ ./5-interactive.sh Do you agree with this? [yes or no]: N Not agreed, you can't proceed the installation tmoyer2@itis-3246:~/scripting-2$ echo $? 255 tmoyer2@itis-3246:~/scripting-2$ ./5-interactive.sh Do you agree with this? [yes or no]: no Not agreed, you can't proceed the installation tmoyer2@itis-3246:~/scripting-2$ ./5-interactive.sh Do you agree with this? [yes or no]: meh Invalid input tmoyer2@itis-3246:~/scripting-2$ echo $? 254

Script:

#!/bin/bash

echo -n "Do you agree with this? [yes or no]: " read yno case $yno in [yY] | [y][e][s] ) echo "Agreed" ;; [nN] | [n][o] ) echo "Not agreed, you can't proceed the installation"; ;; *) echo "Invalid input" ;; esac

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!