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
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)
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)
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)
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)
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)
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)