In the script below - which prompts the user to confirm that they want to proceed with running a potentially bad script - when the user enters Y at the prompt - it will break out of the case block, only to be sent back into the while loop again.#! /bin/bashset -eechoecho bad install startecho -----------------------------------------while true; do        read -p this script will probably fail - do you want to run anyway? yn        case $yn in                [Yy]*)                        ##### WHAT GOES HERE?? #####                        ;;                [Nn]*)                        exit ;;                *)                        echo answer y or n ;;        esac        echo script has broken out of case back into while loopdoneecho -e \e[33m Installing bad packagename \e[0mapt-get install sdfsdfdfsdecho rest of script - will i keep running?When n is entered, the script exists entirely as desired. I'd like to know how to make it so that when Y is entered the script breaks out of both the case and the while block, but does not exit entirely. Is there something I can put in for the placeholder (What goes here??) to do that?
How can I break out of a while loop, from within a nested case statement?
bash;shell script
In the case where the user entered y, you can exit both while and case:break [n]       Exit from within a for, while, until, or select loop.  If  n  is       specified, break n levels.  n must be  1.  If n is greater than       the number of enclosing loops, all enclosing loops  are  exited.       The  return  value is 0 unless n is not greater than or equal to       1.In your case, you want to do break 2.