Hiya, I am assuming you are looking to have a sub-menu under an option that will return back to the main menu when exited. This example from another post I replied to shows a way to set up a menu framework using nested select constructs to create the menus. Run it and see if you get some ideas.
Code:
$ cat xxx
#!/usr/bin/ksh
# Set select construct prompts for each menu level.
typeset -r MAINPROMPT="Select a main option: "
typeset -r MANGOPROMPT="Select mango option: "
# Loop main menu until user exits explicitly.
while :
do
print "\nTop-level Menu Title Goes Here\n"
PS3=$MAINPROMPT # PS3 is the prompt for the select construct.
select option in "mango (has a sub-menu)" tango rango exit
do
case $REPLY in # REPLY is set by the select construct, and is the number of the selection.
1) # mango (has a sub-menu)
# Loop mango menu until user exits explicitly.
while :
do
print "\nmango sub-menu title\n"
PS3=$MANGOPROMPT
select option1 in add substract exit
do
case $REPLY in
1) # add
print "\nYou picked [add]"
break # Breaks out of the select, back to the mango loop.
;;
2) # subtract
print "\nYou picked [subtract]"
break # Breaks out of the select, back to the mango loop.
;;
3) # exit
break 2 # Breaks out 2 levels, the select loop plus the mango while loop, back to the main loop.
;;
*) # always allow for the unexpected
print "\nUnknown mango operation [${REPLY}]"
break
;;
esac
done
done
break
;;
2) # tango
;& # Fall through to #3
3) #rango
print "\nYou picked $option"
break
;;
4) # exit
break 2 # Break out 2 levels, out of the select and the main loop.
;;
*) # Always code for the unexpected.
print "\nUnknown option [${REPLY}]"
break
;;
esac
done
done
exit 0
$
Hello all,
I would like to change the options on the root menu when I use the middle button on a three mouse buttom setting. I can append to the menu but, I seem to be unable to find the lisp code for pop-root-menu. Does anyone know how to change this? THANKS ALL (3 Replies)
I'm programming a menu for an intro to unix class and am hung up on 2 required options. One has to exit from unix. The other has to get a command prompt by using one of the menu choices, then return to the menu via CTRL-D. below is my code
#!/bin/ksh
#Jimmy's happy menu
mesg y
msg="ON"... (2 Replies)
Hi all,
I would like to have some details on menu.lst!!
the reason is ,if i am trying to add my own boot option where do i need to add it?
is it in menu.lst only or elsewere(am referring to unix os)
because i tried adding a unique boot option and it was not reflected when the system booted?... (8 Replies)
Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted!
1. The problem statement, all variables and given/known data:
1) Write a Menu Driven Shell Script which accepts1 to 5 options and performs the following actions for... (1 Reply)
I dual boot between Windows XP and Linux Mint. I am trying to get the Windows Advanced Options Menu to show up. Normally you would press f8 to make this happen when your computer is booting. With a dual boot it makes it way more complicated. If you press f8 when your computer first starts it does... (3 Replies)
Hopefully I'm in the right place. Im new to the forums and linux!
I'm looking to add a menu to my perl hangman game i have created. The menu will use user input for the desired option and then perform the operation indicated. I would like something along the lines of:
Welcome to Hangman... (1 Reply)
hi all i am a newbie to this
is there any examples on creating a main menu with 3 sub menu
main menu -> option a , b and c
a menu -> option 1 ,2 and 3
b menu -> option 1 ,2
c menu -> option 1 ,2
i am getting headache as my code kept getting unexpected EOF
---------- Post... (0 Replies)
I have a menu option which will look as follows
Select a menu option
1.change password
2.login as root user
3.show system version
4.quit
Select> 1
please enter the new password: unix
reenter the new password: unix
press any key to enter
(then displays again the menu options to enter the... (4 Replies)
Hi Friends,
I have a menu based tool which requires input/option to proceed further. How to make a shell script ?
eg: menu looks like
Get_data.sh
to continue (y/n) :
Here I need to key in "y" to proceed.
I want to prepare a script which should consider option y. (5 Replies)
I installed CentOS 8 with Gnome 3.28.2 and I noticed that the "switch user" menu item disappeared from under the system menu of Gnome classic (Both X11 & Wayland). I checked google and this problem seems to have a history going back several releases of Gnome.
Unfortunately, I never found a... (1 Reply)
Discussion started by: bodisha
1 Replies
LEARN ABOUT OPENSOLARIS
tk_optionmenu
tk_optionMenu(1T) Tk Built-In Commands tk_optionMenu(1T)__________________________________________________________________________________________________________________________________________________NAME
tk_optionMenu - Create an option menubutton and its menu
SYNOPSIS
tk_optionMenu w varName value ?value value ...?
_________________________________________________________________DESCRIPTION
This procedure creates an option menubutton whose name is w, plus an associated menu. Together they allow the user to select one of the
values given by the value arguments. The current value will be stored in the global variable whose name is given by varName and it will
also be displayed as the label in the option menubutton. The user can click on the menubutton to display a menu containing all of the val-
ues and thereby select a new value. Once a new value is selected, it will be stored in the variable and appear in the option menubutton.
The current value can also be changed by setting the variable.
The return value from tk_optionMenu is the name of the menu associated with w, so that the caller can change its configuration options or
manipulate it in other ways.
KEYWORDS
option menu
ATTRIBUTES
See attributes(5) for descriptions of the following attributes:
+--------------------+-----------------+
| ATTRIBUTE TYPE | ATTRIBUTE VALUE |
+--------------------+-----------------+
|Availability | SUNWTk |
+--------------------+-----------------+
|Interface Stability | Uncommitted |
+--------------------+-----------------+
NOTES
Source for Tk is available on http://opensolaris.org.
Tk 4.0 tk_optionMenu(1T)