self calling function issue

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • momotaro
    Contributor
    • Sep 2006
    • 357

    self calling function issue

    Hi,
    When I try to call a function1 again inside this same function I get unexpected results!

    Code:
    case $choixMenu in
        0) PROMPT ;;
        1) echo "$PWD" ;
           MENUFUNCTION ;
        2) echo "Veuillez entrer la nouvelle valeur de PWD";
           read PWD;
           echo "$PWD" ;
           MENUFUNCTION ;
      esac
    this is MENUFUNCTION :

    Code:
    function MENUFUNCTION
    {
      echo "        [1]-AFFICHER"
      echo "        [2]-MODIFIER"
      echo "        [0]-REVENIR AU MENU PRINCIPAL"
      echo
      echo "        Veillez faire un choix!"
      read choixMenu
    }
    the issue: when I retype [1] second time (or another) I don't get the result needed it just prompt the choice number...

    Thank's in advance
  • horace1
    Recognized Expert Top Contributor
    • Nov 2006
    • 1510

    #2
    have you forgotten the ;; on the end of lines 4 and 8 in
    Code:
    case $choixMenu in
        0) PROMPT ;;
        1) echo "$PWD" ;
           MENUFUNCTION ;
        2) echo "Veuillez entrer la nouvelle valeur de PWD";
           read PWD;
           echo "$PWD" ;
           MENUFUNCTION ;
      esac

    Comment

    Working...