Simple Menu and coding


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Simple Menu and coding
# 1  
Old 12-11-2007
Simple Menu and coding

I am very new to Unix and don't know much about it. I've been trying to create a menu and what I don't understand is how to execute a command once a user makes a selection. I have the menu set up. In fact, the following is the code that I have thus far:

#! /bin/csh
# This is the UNIX menu script file that is for the menu.

cat <<ENDINPUT

Menu of Options

1. Display all files in a user's home directory
2. Welcome yourself to the program
3. Display System Information
4. Exit back to Windows

ENDINPUT
echo Please enter your choice:
read option

case $option
1.

I'm stuck at this point. What I am SPECIFICALLY looking for in option 1 is code that will prompt a user to enter another user's name and will then pull up that user's home directory. If the user does NOT enter anything, then their own home directory is displayed. What is the EXACT code that would accomplish this? Examples haven't helped me. Oh how batch files are much easier. I'm looking for the exact coding!!!

In option 2 I have to prompt the user to enter his or her name, and produce the following: Hello <person's name.>

I am desparate for help with this. Any help would be greatly appreciated. And again, I'm looking for EXACT code, not examples. Thank you.Smilie
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Gnome 3.28.3 menu item dissapears under the system menu

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

2. Shell Programming and Scripting

Simple calculator with menu input - Need Help

I am trying to make a calculator. The user Enters number 1, chooses and operation, enters number 2, then chooses another operation or for the answer to be displayed. eg. 1 + 1 = or 1 + 1 + 2 + 1 = Both of these should be possible. #!/bin/bash read -p "what's the first number? " n1... (3 Replies)
Discussion started by: redshine6
3 Replies

3. UNIX for Dummies Questions & Answers

Simple bash script menu

Dear Sir, May I know how do I go about adding the following feature into the script below: When user enter values other than 1,2,3,4, a) Message “Wrong entry !!! Pls select 1,2,3 or 4” is displayed b) The screen is cleared again and the menu is displayed. #!/bin/bash clear var=1... (2 Replies)
Discussion started by: fusetrips
2 Replies

4. Shell Programming and Scripting

Need help in create menu with 3 sub menu using the case command

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)
Discussion started by: chercm
0 Replies

5. Shell Programming and Scripting

Two columns output in simple case menu?

EDIT : System used : Any Linux distribution. Hello everyone, I m having quite a headache trying to figure out why I m having a 2 columns output in the following code : #!/bin/ksh menu_rotation() { #Variables CHOIX1="Rotation 1" CHOIX2="Rotation 2" CHOIX3="Rotation 3" ... (11 Replies)
Discussion started by: Sekullos
11 Replies

6. Shell Programming and Scripting

Perl simple text menu with options

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)
Discussion started by: jahburmski
1 Replies

7. Shell Programming and Scripting

Menu in Menu script issue

Problem: I am trying to create a menu in a menu script and I am running into an issue with the calculator portion of the script. I am first presented with the ==Options Menu== which all 5 options working correctly. Now comes the fun part. I select option 1 which takes me to my ==Calculator... (1 Reply)
Discussion started by: iDdraig
1 Replies

8. Shell Programming and Scripting

help with scripting a simple menu

Hi there. I'm trying to teach myself UNIX but the book I bought is a bit confusing. I'm trying out this exercise and I think I'm on the right track, but I'd appreciate any suggestions on how to improve what I have so far. Also, I'm not clear on how to use the read command to utilize the user's... (3 Replies)
Discussion started by: Jsmith
3 Replies

9. Shell Programming and Scripting

Desperate for help with menu coding

I am extremely desperate for help with this menu coding problem I'm having. Whenver I go to execute my script file, I keep getting an error message that says the following: option: Undefined variable. I implore someone to PUH-LEEZE point me in the right direction. I can't stress my... (21 Replies)
Discussion started by: sinjin
21 Replies
Login or Register to Ask a Question
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)