multiple looping with case and funtion showing error, Please help

Hello All,

I have code as follows :-

while true do
  [calling a function]
   {opening a case1 statement} 
    1) 
      [Calling another function]
        {opening another case2 statement} 
        {closing case 2}
     2)
  Showing error for "2)" as Syntax error at line 59 : `)' is not expected.
     *) 
    {closing case 1} 
 done

This is the structure of my script. I am not able to figure out it. Could anyone crack this ?

Thanks
Renjesh

If you expect people help you to troubbleshoot your script, then people need you to provide the code (and not only the structure of it).

Here is the code :-

choice=""
tgtser=""
function menu
{
    clear
    echo "-------------------------------------------------------"
    echo " * * * * * * * Subversion Main Menu * * * * * * * * * * "
    echo "-------------------------------------------------------"
    echo "[1] check-out to test server"
    echo "[2] check-in"
    echo "[3] check-out to local machine"
    echo "[4] Exit/stop"
    echo "----------------------------------------------"
    echo "Enter your menu choice [1-4]: \n"
    read choice
}
function chkout1
{
     clear
     echo "Please select a target server .."
     echo "[1] AIX - st95esra"
     echo "[2] AIX - st95esrb"
     echo "[3] AIX - st95esre"
     echo "[4] HP-UX - st95esr0"
     echo "[5] HP-UX - st95esr1"
     echo "[6] HP-UX - st95esr2"
     echo "[7] Linux - st95esrn"
     echo "[8] Linux - st95esro"
     echo "[9] Linux - st95esrp"
     echo "[10] Linux - st95esrq"
     echo "[11] Linux - st95esrr"
     echo "Enter your menu choice [1-11]: \n"
     read tgtser
}
echo "================ MAIN SESSION =================="
while true do
     menu
     case $choice in
     1)
            chkout1
            case $tgtser in
                 1|2|3|4|5|6|7|8|9|10|11)
                         echo "Checked out to test server ..."
                         ;;
                 *)      echo "Opps !!! please select a valid option"
                         sleep 2
                         chkout1
                         ;;
            esac
     2)            echo "Checked in ..." ;;
            ;;
     3)
            echo "Checked out to local machine ..."
            ;;
     4)
            echo "Exiting ... "
            ;;
     *)
            echo "Opps !!! please select a valid option (1/2/3/4)" ;;
            sleep 2
            menu
            ;;
     esac
 done

Error showing in RED in the code :- ./test1[46]: Syntax error at line 60 : `)' is not expected.

You miss ";;" after the "esac" which is just above the "2)"

what happened ?

I didn't try it so maybe it would require some fix, but in the main loop maybe it could be better with something like :

while true 
do
    menu
    case $choice in
    1)            
        while :
        do
            chkout1
            case $tgtser in
            1|2|3|4|5|6|7|8|9|10|11)
                echo "Checked out to test server ..."
                break
            ;;
            *)      echo "Opps !!! please select a valid option"
                sleep 2
            ;;
            esac
        done
    ;;
    2)
        echo "Checked in ..."
    ;;
    3)
        echo "Checked out to local machine ..."
    ;;
    4)
        echo "Exiting ... "
    ;;
    *)
        echo "Opps !!! please select a valid option (1/2/3/4)" ;;
        sleep 2
    ;;
esac
done

You must not make duplicate calls of 'chkout1' or 'menu' you must use the while loop instead.