title: Creating sub menu in bash
body: <p>I'm trying to do the following :</p>
  
  <pre><code>function main_menu 
  {
  option=0
  until [ "$option" = "4" ]; do
  echo "  1.) Add user"
  echo "  2.) Remove user"
  echo "  3.) Update user"
  echo "  4.) Quit"
  
  echo -n "Enter choice: "
  read option
  echo ""
  case $option in
      1 ) add_user ; press_enter ;;
      2 ) remove_user ; press_enter ;;
      3 ) update_user ; press_enter ;;
      4 ) exit;;
      * ) tput setf 4;echo "Please enter 1, 2, 3, or 4";tput setf 4; 
  esac
  done
   }
  </code></pre>
  
  <p>In a switch case(do while option is not 4).The 3rd option will show another sub menu with switch case as follows:</p>
  
  <pre><code>function update_user 
  {
   option=0
   until [ "$option" = "3"]; do
   echo "  1.) Update username"
   echo "  2.) Update password"
   echo "  3.) Return to menu"
  
   echo -n "Enter choice: "
   read option
   echo ""
   case $option in
   1 ) update_username; press_enter ;;
   2 ) update_password; press_enter ;;
   3 ) main_menu; press_enter ;;
   4 ) exit;;
   * ) tput setf 3;echo "Please enter 1, 2 or 3";tput setf 3; 
   esac
   done
    }
  </code></pre>
  
  <p>The 3rd option goes back to the main menu, but when I try to quit the sub menu keeps appearing.</p>
  
  <p>Anyone can advise me on a better way?</p>