Menu driven using Ksh


 
Thread Tools Search this Thread
Top Forums UNIX for Advanced & Expert Users Menu driven using Ksh
Prev   Next
# 4  
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..
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. 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

2. 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

3. 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

4. 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

5. 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

6. 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

7. 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

8. 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

9. 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

10. 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
Login or Register to Ask a Question
sysman(8)						      System Manager's Manual							 sysman(8)

NAME
sysman - Front end command used to invoke several SysMan services SYNOPSIS
/usr/sbin/sysman -menu /usr/sbin/sysman -station /usr/sbin/sysman -cli /usr/sbin/sysman -clone /usr/sbin/sysman -help OPTIONS
Launches the SysMan Menu (sysman_menu(8)). Launches the SysMan Station (sysman_station(8)). Command line interface for manipulating sys- tem management data (sysman_cli(8)). Saves and replicates SysMan configuration information for installation cloning (sysman_clone(8)). Cloning is not supported in a cluster environment. Displays help on the sysman command. DESCRIPTION
The sysman command provides a common interface for invoking several SysMan services: A menu driven, task oriented system management tool. SysMan Menu and its associated tasks can run on a character cell terminal, an X Windows display, from a PC, or from a Web browser. A graphical interface for monitoring and managing a single or cluster system. The SysMan Menu and its specific tasks can be launched from the SysMan Station. Provides a generic command line interface to the System Management (SysMan) data. Saves certain SysMan configuration information from a previously configured system and replicate that configuration information across one or more clients. For more information on a specific command, please refer to the specific reference page. For the SysMan Menu and the SysMan Station, you also can refer to the online help. SEE ALSO
Commands: sysman_menu(8), sysman_station(8), sysman_cli(8), sysman_clone(8) System Administration sysman(8)