Sponsored Content
Full Discussion: Menu driven using Ksh
Top Forums UNIX for Advanced & Expert Users Menu driven using Ksh Post 8999 by jerzey4life on Saturday 20th of October 2001 10:28:29 PM
Old 10-20-2001
or something like this.. i needed help once getting my script to repeat or bomb my menus and a nice person sent me this
Code:
#!/usr/bin/ksh
# simple menu - doesn't really do anything
# You may need to change this:
alias echoe="/bin/echo -e"

# functions:
func_1 () {
echoe "Yay \n\n"
}
func_2 () {
echoe "Boo \n\n"
}
menu_list () {
clear
                echoe "\n\n\t\tThis is the title\n\n\n"
                echoe "Make your choice: \n"
                echoe "To say Yay, press 1 \n"
                echoe "To say Boo, press 2 \n"
                echoe "To quit, press "q" \n"
}

go_ahead () {
tput smso
echoe "Press any key to return to the menu  \c"
tput rmso
oldstty=`stty -g`
stty -icanon -echo min 1 time 0
dd bs=1 count=1 >/dev/null 2>&1
stty "$oldstty"
echoe
}
func_select () {
tput smso
echoe "\nPlease make your selection ( )\b\b\c"
read selection
tput rmso
case $selection in
     1) clear ; func_1 ; go_ahead ;; 
     2) clear ; func_2 ; go_ahead ;;
     q|Q) tput rmso ; clear ; exit 0 ;;
esac
}
#
# Here is where is gets looped - basically forever, until
# the "q" option is selected, causing an explicit exit
#

while `true`
do
menu_list
func_select
done

added code tags for readability --oombera

Last edited by oombera; 02-20-2004 at 11:48 AM..
 

10 More Discussions You Might Find Interesting

1. Programming

menu driven ( like pine) on Linux

Hi guys, I am designing the rdbms in C/C++ on linux platform as my project. Can any one help me in designing menu driven screen (like the pine ) which will print on screen as follows 1) create table 2) add table ............. etc with arrow keys for... (2 Replies)
Discussion started by: amit
2 Replies

2. UNIX for Advanced & Expert Users

Menu Driven UNIX Admin

I need to have a script that can do an automated IPL function (how to reboot the box). I think ‘reboot’ would do the trick. However, how would I go about doing it, for example if the user states from a menu script that I would like to reboot now. The problem is when I do the ‘reboot’ command I... (6 Replies)
Discussion started by: ad4m88
6 Replies

3. Homework & Coursework Questions

Menu Driven Shell Script which accepts1 to 5 options

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

4. Shell Programming and Scripting

Menu driven Script needed ..pls help

Hi Guys.. am new to unix scrpiting..I need a Menu need to create using shell scrpting eg: Food items ready paid if i press "f" need to add items for a file food items.. if i press "r" it need to move into ready and remove from food items if i press "p" need to update a filed in... (1 Reply)
Discussion started by: sasdua
1 Replies

5. UNIX for Dummies Questions & Answers

What is a menu or command line option driven script?

i'm confused what this means. i was asked to design a menu or command line option driven script that reads out of a DB and displays info such as read_data.pl -u <user> -e <event> which would print commands run by <user>with the <event> in the db. any suggestions? i've been using... (2 Replies)
Discussion started by: kpddong
2 Replies

6. Shell Programming and Scripting

Help needed in writing a menu driven script

Hi, I was wondering if someone could help me write a shell script in Linux that backsup/restores data to anywhere I choose but it needs to be menu driven? Thanks, I'm new to Linux/Unix but liking it so far...just hoping to get to grips with the scripts! :) (7 Replies)
Discussion started by: Nicole
7 Replies

7. Shell Programming and Scripting

Menu driven script.

I'm a beginner at scripting and have been putting this script together over the past week. It's no where as polish as it could be. Any tips/suggestions on improving this script would be appreciate it. Every week, my team develops WAR files in tomcat on our test environment and moves them to our... (4 Replies)
Discussion started by: bouncer
4 Replies

8. Shell Programming and Scripting

Use of stty vs trap in script-driven login menu

My employers would like me to selectively run one of several different (already-existing) Korn Shell menu-driven scripts out of the user's .profile file, depending on some yet-to-be-specified user critieria. I've never done this kind of thing, but I have the existing scripts (among other... (5 Replies)
Discussion started by: Clovis_Sangrail
5 Replies

9. UNIX for Dummies Questions & Answers

System administration tasks performed from a menu driven interface

I need to write a shell script that allows some system-administration tasks to be preformed automatically from a menu-driven interface. Automate the following tasks: • Copy directory tree • Delete files or directories • Output Information But I don't understand the question. What is a "menu... (2 Replies)
Discussion started by: femchi
2 Replies

10. Shell Programming and Scripting

Using menu driven script

Hi Team , I wrote a shell script for adding and subtracting two numbers am getting error could some one please help to fix it script: echo "Enter 1 to add:" echo "Enter 2 to sub:" echo "Enter 3 for both addition and subtraction :" read ans; case "$ans" in 1)... (4 Replies)
Discussion started by: knz
4 Replies
Gtk2::Menu(3)						User Contributed Perl Documentation					     Gtk2::Menu(3)

NAME
Gtk2::Menu HIERARCHY
Glib::Object +----Glib::InitiallyUnowned +----Gtk2::Object +----Gtk2::Widget +----Gtk2::Container +----Gtk2::MenuShell +----Gtk2::Menu INTERFACES
Glib::Object::_Unregistered::AtkImplementorIface Gtk2::Buildable METHODS
widget = Gtk2::Menu->new accelgroup = $menu->get_accel_group $menu->set_accel_group ($accel_group) o $accel_group (Gtk2::AccelGroup) string = $menu->get_accel_path Since: gtk+ 2.14 $menu->set_accel_path ($accel_path) o $accel_path (string) widget = $menu->get_active $menu->set_active ($index) o $index (integer) $menu->attach ($child, $left_attach, $right_attach, $top_attach, $bottom_attach) o $child (Gtk2::Widget) o $left_attach (integer) o $right_attach (integer) o $top_attach (integer) o $bottom_attach (integer) Since: gtk+ 2.4 $menu->attach_to_widget ($attach_widget, $detacher) o $attach_widget (Gtk2::Widget) o $detacher (scalar) widget = $menu->get_attach_widget $menu->detach list = Gtk2::Menu->get_for_attach_widget ($widget) o $widget (Gtk2::Widget) Since: gtk+ 2.6 integer = $menu->get_monitor Since: gtk+ 2.14 $menu->set_monitor ($monitor_num) o $monitor_num (integer) Since: gtk+ 2.4 $menu->popdown $menu->popup ($parent_menu_shell, $parent_menu_item, $menu_pos_func, $data, $button, $activate_time) o $parent_menu_shell (Gtk2::Widget or undef) o $parent_menu_item (Gtk2::Widget or undef) o $menu_pos_func (scalar) o $data (scalar) o $button (integer) o $activate_time (integer) $menu->reorder_child ($child, $position) o $child (Gtk2::Widget) o $position (integer) $menu->reposition $menu->set_screen ($screen) o $screen (Gtk2::Gdk::Screen) Since: gtk+ 2.2 boolean = $menu->get_tearoff_state $menu->set_tearoff_state ($torn_off) o $torn_off (boolean) string = $menu->get_title $menu->set_title ($title) o $title (string) PROPERTIES
'accel-group' (Gtk2::AccelGroup : readable / writable / private) The accel group holding accelerators for the menu 'accel-path' (string : readable / writable / private) An accel path used to conveniently construct accel paths of child items 'active' (integer : readable / writable / private) The currently selected menu item 'attach-widget' (Gtk2::Widget : readable / writable / private) The widget the menu is attached to 'monitor' (integer : readable / writable / private) The monitor the menu will be popped up on 'reserve-toggle-size' (boolean : readable / writable / private) A boolean that indicates whether the menu reserves space for toggles and icons 'tearoff-state' (boolean : readable / writable / private) A boolean that indicates whether the menu is torn-off 'tearoff-title' (string : readable / writable / private) A title that may be displayed by the window manager when this menu is torn-off SIGNALS
move-scroll (Gtk2::Menu, Gtk2::ScrollType) ENUMS AND FLAGS
enum Gtk2::ScrollType o 'none' / 'GTK_SCROLL_NONE' o 'jump' / 'GTK_SCROLL_JUMP' o 'step-backward' / 'GTK_SCROLL_STEP_BACKWARD' o 'step-forward' / 'GTK_SCROLL_STEP_FORWARD' o 'page-backward' / 'GTK_SCROLL_PAGE_BACKWARD' o 'page-forward' / 'GTK_SCROLL_PAGE_FORWARD' o 'step-up' / 'GTK_SCROLL_STEP_UP' o 'step-down' / 'GTK_SCROLL_STEP_DOWN' o 'page-up' / 'GTK_SCROLL_PAGE_UP' o 'page-down' / 'GTK_SCROLL_PAGE_DOWN' o 'step-left' / 'GTK_SCROLL_STEP_LEFT' o 'step-right' / 'GTK_SCROLL_STEP_RIGHT' o 'page-left' / 'GTK_SCROLL_PAGE_LEFT' o 'page-right' / 'GTK_SCROLL_PAGE_RIGHT' o 'start' / 'GTK_SCROLL_START' o 'end' / 'GTK_SCROLL_END' SEE ALSO
Gtk2, Glib::Object, Glib::InitiallyUnowned, Gtk2::Object, Gtk2::Widget, Gtk2::Container, Gtk2::MenuShell COPYRIGHT
Copyright (C) 2003-2008 by the gtk2-perl team. This software is licensed under the LGPL. See Gtk2 for a full notice. perl v5.12.1 2010-07-05 Gtk2::Menu(3)
All times are GMT -4. The time now is 08:01 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy