I'm trying to make this BASH script require the user to input a value between 1 through 4 to choose a ninja turtle in the case statement. Any other value will cause $COUNTER to remain equal to 0 therefore requiring the case statement to execute again. However, I end up in an infinite loop if I enter any value other than 1 through 4.
1st - How do I nest a case statement inside a while loop?
2nd - How do I make this script require the user input a value between 1 - 4
#!/bin/bash echo "What is your favorite Ninja Trutle?" echo "1 - Raphael." echo "2 - Leonardo." echo "3 - Michelangelo" echo "4 - Donatello" read TURTLE; COUNTER=0; while [ $COUNTER -eq 0 ] do $COUNTER=$(( $COUNTER + 1 )) case $TURTLE in 1) echo "Raphael is cool, but rude.";; 2) echo "Leonardo leads.";; 3) echo "Michelangelo is a party dude.";; 4) echo "Donatello does machines.";; *) echo "Did you even watch the show?" $COUNTER=0 ;; esac done
Thanks for any help provided.