You can use break to get out of a while loop without exiting the entire script.
Use function when you do some tasks many times.
By the way, here is a sample of your code with some little improvment
If we want to exit, there already is a choice in the menu, so .... the following lines are useless (and even bad for the workflow of query)
It's me again :)
I would like to create a script that will display a 'Main Menu' which will link to other scripts in the same directory. Is it possible to have a scrolling menu and pretty colours for this? :) (9 Replies)
I'm working on a script for a basic menu with four options. The first option for the menu asks a user to put in anyone's user name and is supposed to display the user's home directory. If a user does not enter a name, then their own home directory should be displayed. The second menu option is... (0 Replies)
So, I need help writing a Menu script in UNIX.
First how can I use letters for the options instead of numbers?
Also, is there any templates out on the web I can use? (2 Replies)
The code im having problems with is highlighted in red, upon selecting option 2 on the main menu (highlighted green) my echo "NETWORK CONNECTIVITY" command seems to get overlooked and the resulting output is "Thank you for using the Operator Administrative Tool." being displayed. Can anyone tell me... (2 Replies)
Hi,
I need to have a shell script for the below need.
1. Menu with one heading and 4 options.
2. the heading and 4 options are taken from a file.
File entry
======
Heading1|option1|option2|option3|option4|
Heading2|option1|option2|option3|option4|
3. the user entries must be captured in... (9 Replies)
Hi!
I have created on script which is working fine with menu options and with a sub-menu.
I want to enhance it by using sub-options under menu options.
Like.
option 1) will give the list only.
option 1.1) should give the option to user to choose one file, whose content user wanna see. ... (3 Replies)
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 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 DEBIAN
menu2_6
Menu(3I) InterViews Reference Manual Menu(3I)NAME
Menu, MenuItem, MenuBar, PopupMenu, PulldownMenu, PullrightMenu - menus
SYNOPSIS
#include <InterViews/menu.h>
DESCRIPTION
N.B.: This Menu class is completely different from the Menu class in version 2.5. No attempt has been made to be compatible, as this class
and its subclasses are more powerful and easier to use than the original class.
Menu is a subclass of Control that contains a scene of other controls, called its body. When a menu is opened, it inserts the body into
the world with a drop shadow. The appearance of the menu itself is defined by its interactor component. For example, a menu in a menu bar
might appear as ``File'' and insert a pulldown menu with commands such as ``Save'' when opened.
MenuItem is a subclass of Control for defining the leaves of a menu hierarchy. Normally, an application will derive a command class from
MenuItem and implement the virtual function Do as appropriate. One technique is to pass the Command an application object and pointer to
member function; the Do function calls the member function on the application object.
PopupMenu, PulldownMenu, and PullrightMenu are subclasses of Menu that implement a common styles of menus. MenuBar is a subclass of HBox
that manages the control state associated with a set of menus. PopupMenu has no appearance; it is opened explicitly in response to an
input event. PulldownMenu and PullrightMenu open the menu body below and to the right of the menu, respectively. These classes make it
possible to use menus in an application without creating or passing control states explicitly.
PUBLIC OPERATIONS
Menu::Menu(Interactor*)
Construct a new menu.
Menu::~Menu()
The destructor deletes the menu body in addition to its appearance component.
virtual void Menu::Include(Control*)
Add an item to the menu. If no scene is specified, Menu will create a vbox and insert items into it.
virtual void Menu::Popup(Event&)
Insert the body into the world centered around the coordinates associated with the event and activate the controls in the body. The
menu is removed from the world when the controls are deactivated (normally when a button is released).
void Menu::SetBody(Interactor*)
Interactor* Menu::GetBody()
void Menu::SetAlign(Alignment)
Alignment Menu::GetAlign()
void Menu::SetDepth(int)
int GetDepth()
void Menu::SetBodyState(ControlState*)
ControlState* Menu::GetBodyState()
void Menu::SetScene(Scene*)
Scene* Menu::GetScene()
Set or get attributes of the menu. The depth of a menu is the number of pixels separating the body and the drop shadow.
Coord Menu::InsertX()
Coord Menu::InsertY()
Return the coordinates where the menu's body was last inserted into the world.
MenuItem::MenuItem(Interactor*)
MenuItem::MenuItem(const char* str, Alignment = Left)
Construct a new menu item. The second constructor defines the appearance of the item to be a message containing the text in str.
PulldownMenu::PulldownMenu(Interactor*)
PulldownMenu::PulldownMenu(const char* str)
PullrightMenu::PullrightMenu(Interactor*)
PullrightMenu::PullrightMenu(const char* str)
Construct a new pulldown or pullright menu. The second constructor defines the appearance of the menu to be a message containing
the text in str.
PopupMenu::PopupMenu()
Construct a new popup menu.
MenuBar::MenuBar()
Construct a new menu bar.
virtual void MenuBar::Include(Control*)
Add a control to a menu bar. In addition to inserting the control into the bar's hbox, this operation attaches the control to the
bar's control state.
SEE ALSO Control(3I), Event(3I)InterViews 6 December 1989 Menu(3I)