Operating System - Linux
1828346 Members
3232 Online
109976 Solutions
New Discussion

Re: Working with menus ...

 
SOLVED
Go to solution
Manuales
Super Advisor

Working with menus ...

Hi ...
how can i do a "sub-menu" into a menu?
I mean ..
for example, i have the following:

#!/usr/bin/ksh
clear
. $HOME/ENVIRONMENT/environment.sh
echo "###############################################################"
echo " "; banner "DRT MENU"
echo ""
echo " Server: $(hostname) ----- $(date) "
echo "###############################################################"
echo " "
lista='
DELETE_FILES
GET_FILES_SYSTEM_ALL_LEGACY_SERVERS
REMOTE_FILE_DISTRIBUTION_TO_ALL_LEGACY_SERVERS
STARTING_CRON_IN_ALL_LEGAY_SERVERS.sh
EXIT'
PS3="Option : "
select opcion in $lista
do
case $opcion in
"DELETE_FILES" ) ????????????? ;;
"GET_FILES_SYSTEM_ALL_LEGACY_SERVERS" ) ${menu}/hola.sh ;;
"REMOTE_FILE_DISTRIBUTION_TO_ALL_LEGACY_SERVERS" ) ${menu}/hola.sh ;;
"STARTING_CRON_IN_ALL_LEGAY_SERVERS.sh" ) ${menu}/hola.sh ;;
"EXIT" ) exit ;;
esac
done

into DELETE_FILES (where it says ?????????? )Option i need to put other sumbenu for choosing other options ... how can i do that???

PLEASE LET ME KNOW
1 REPLY 1
James R. Ferguson
Acclaimed Contributor
Solution

Re: Working with menus ...

Hi Manuales:

Simply add another 'select' loop.

...
listb='
FILESET1
FILESET2
FILESET3
QUIT'
...
"DELETE_FILES" )
echo "Deleting..."
PS3="Reply : "
select reply in $listb
do
case $reply in
"FILESET1" ) echo "deleting #1" ;;
"FILESET2" ) echo "deleting #2" ;;
"FILESET3" ) echo "deleting #3" ;;
"QUIT" ) PS3="Option : "; break ;;
esac
done
;;
...

NOTE that you need to reset the 'PS3' prompt as you leave the inner 'select' loop. Otherwise your user will continue to be prompted with "Reply" as established for the current loop.

Regards!

...JRF...