title: How to I return back to the main menu, from a function?
body: <p>I have a problem coming back to the main menu, from a function. My BASH script looks something like this</p>
  
  <pre><code> function functionA(){
  
      while [ "$choice" != x ]; do 
         echo "Press a to take action, and press b to exit and go back to the main list" 
         read choice 
         case $choice in 
            a)
               echo "Now lets do some stuff" 
               read 
               ... 
               ..... 
               ;; 
          x) 
             exit
         esac 
      done 
   }
  
  
   while [ "$choice" != x ];do 
       echo "Main list" 
       echo "Press a to go to functionA, press b to go to functionB, and press x to exit the program" 
       read choice
  
      case $choice in  
          a) functionA 
             ;; 
          b) functionB 
             ;;
         c) exit
  
      esac 
   done
  </code></pre>
  
  <p>So basically, if the user is in <code>functionA()</code> and presses <code>x</code> to quit, I want him to come back to the main list, and there he will be able to go to <code>functionA()</code> again or <code>functionB()</code>, or just press <code>x</code> again to quit the whole program.</p>