Sponsored Content
Full Discussion: Return to a submenu
Top Forums Shell Programming and Scripting Return to a submenu Post 302437860 by iga3725 on Friday 16th of July 2010 10:24:34 AM
Old 07-16-2010
Return to a submenu

Hi, I have this menu:

Code:
main_menu()
{
while true
do
        print "    ************************************"
        clear
        print "    1) Configuracion de RBAC (ADMIN)."
        print "    2) Configuracion de roles a usuarios (SISTEMAS)."
        print "    3) Salir."

        echo
        echo "     Seleccione la opcion:"
  
        trap "" INT HUP QUIT TERM 18

        stty -echo
        read SELECT
        stty echo

         case $SELECT in
                1)      menu_1
                        ;;
                2)      menu_2
                        ;;
                3)      return
                        ;;
        esac
done
}
#
menu_1()
{
clear
while true
do
        echo
        print "    ************************************"
        print "    a) Configuracion de RBAC."
        print "    b) Listar cmds/scripts de un role en especifico."
        print "    c) Listar cmds/scripts privilegiados definidos por CSIA"
        print "    d) Listar autorizos/privilegios de un comando en especifico."
        print "    e) Ir al menu anterior."
        print "    f) Salir."

        echo
        echo  "    Seleccione la opcion:"
        echo
        echo  "    Seleccione la opcion:"
        echo
        stty -echo
        read SELECT2
        stty echo
        case $SELECT2 in
                "a")    smitrbac.ksh
                        # sleep 5
                        return
                        ;;
                "b")    role2cmds.ksh
                        # sleep 8
                        return
                        ;;
                "c")    listrbaccmds.ksh
                        # sleep 5
                        return
                        ;;
                "d")    findrbacauth.ksh
                        # sleep 5
                        return
                        ;;
                "e")    return
                        ;;
                "e")    break 2
                        ;;
                "")     return
                        ;;
                *)      print ""Opcion Invalida""
                        return
                        ;;
        esac
done
}
#
menu_2()
{
# Validando si es un usuario con el role de siscsia (grupo sistema)
[ "$( id | sed 's/uid=\([0-9]*\)(.*/\1/' )" = 0 ] ||roleactive  || return
clear
while true
clear
while true
do
        echo
        print "    ************************************"
        print "    a) Listar todos los roles en el sistema."
        print "    b) Anadir roles a un ususario."
        print "    c) Eliminar roles a un usuario."
        print "    d) Listar todos los usuarios con sus roles."
        print "    e) Listar roles a un ususario."
        print "    f) Ir al menu anterior."
        print "    g) Salir."
        echo
        echo  "    Seleccione la opcion:"
        echo
        stty -echo
        read SELECT2
        stty echo
        case $SELECT2 in
                "a")    listallroles.ksh
                        sleep 5
                        return
                        ;;
                "b")    addrole2user.ksh
                        sleep 5
                        return
                        ;;
                "c")    delrole2user.ksh
                        sleep 5
                        return
                        ;;
                "d")    listallusersroles.ksh
                        sleep 5
                        return
                        ;;
                "e")    listroles2user.ksh
                        sleep 5
                "e")    listroles2user.ksh
                        sleep 5
                        return
                        ;;
                "f")    return
                        ;;
                "g")    break 2
                        ;;
                "")     return
                        ;;
                *) print ""Opcion Invalida""
                        return
                        ;;
        esac
done
}
#
#######
main_menu
exit

I have a main menu, menu1 and menu2. When I select options 1) (main_menu) AND b) (menu1) for example, when finish it return to main_menu instead the menu1. Is possible to return to menu1 or menu2 when I select any of its options?

thanks
Israel.

Last edited by Scott; 07-16-2010 at 11:25 AM.. Reason: Changed QUOTE to CODE tags - it preserves whitespace
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Return value

Hallo I want write a sh script but I have some troubles! How can I write the Return value to a variable? I need an egrep command with the option -c, how many times it give the pattern. This return value shold be written in a variable. Could you help me? (1 Reply)
Discussion started by: raphael.schwend
1 Replies

2. Shell Programming and Scripting

the return value $?

Could someone tell me that's the return value $? 15 mean? Where can i find out more? Many thanks (3 Replies)
Discussion started by: gusla
3 Replies

3. UNIX for Advanced & Expert Users

if (( $# != 1 )) ---- what will this return

Hi this is an existing code written by somebody. Please help me in understanding the meaning of this if (( $# != 1 )) (3 Replies)
Discussion started by: satgur
3 Replies

4. Programming

cp and rm return non zero value

rm and cp return non zero values sometimes. sprintf(tmp, "rm -rf %s/* 2>/dev/null\n", dest); rc = system( tmp ); rc = 1 and errno =0 sprintf(tmp, "cp -r %s/* %s 2>/dev/null", source, dest); rc = system( tmp ); rc = -1 and errno = 2. The files exist and the paths are correct. I can... (7 Replies)
Discussion started by: latitude
7 Replies

5. UNIX for Dummies Questions & Answers

return ${1-0}

Hi, What does the above command means? this is used in the following function function _set_return_code { return ${1-0} } (3 Replies)
Discussion started by: neeto
3 Replies

6. UNIX for Dummies Questions & Answers

to pick up the Return Code ( RC) from the mailx command and return it to SAS uisng 's

Hi All, Can anyone please let me know the syntax / how to pick up the Return Code ( RC) from the mailx command and return it to SAS uisng 'system()' function and '${?}'. I am in a process to send the mail automatically with an attachment to bulk users. I have used 'Mailx' and 'Unencode'... (0 Replies)
Discussion started by: manas6
0 Replies

7. Shell Programming and Scripting

SubMenu Exit problem!

I basically have a menu driven script in which one of the options from the main menu would open a sub menu, this works fine but i can't seem to be able to exit the sub menu back to the main menu....any ideas? (5 Replies)
Discussion started by: Alendrin
5 Replies

8. Shell Programming and Scripting

Submenu variable problems

The problem is I need it too go from the main menu by pressing 6, to the submenu search_proc. In the search_proc menu/section it need to accept a variable and search the processes for it and sort by PID and Process name. I'm stuck and ran out of ideas. I also cannot figure out why it keeps... (2 Replies)
Discussion started by: skizo787
2 Replies

9. Shell Programming and Scripting

how should I get the return value

ls xx > yy.log echo $? can get the return value of "ls xx" but if I use ls xx |tee -a yy.log I can't get the return value of "ls xx", and I get the return value of the whole cmd "ls xx |tee -a yy.log", it is always "0" my question is how could I get the return value of "ls xx"... (1 Reply)
Discussion started by: yanglei_fage
1 Replies

10. Shell Programming and Scripting

Return: can only `return' from a function or sourced script

Not sure where the problem is. I can run the script without any issue using the following command. . /opt/app/scripts/cdc_migration.sh But it fails with the below error when I try it this way /opt/app/scripts/cdc_migration.sh /opt/app/scripts/cdc_migration.sh: line 65: return: can only... (1 Reply)
Discussion started by: svajhala
1 Replies
All times are GMT -4. The time now is 06:45 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy