From the computer of: seamonkey420
(132 recipes)
Created: Aug 13, 2004
Create a new file (for example, test.ksh)
by typing: vi test.ksh
the file test.ksh will be created and opened in VI.
in this file, we will add the following lines (i will explain each below)
________
clear
print "TEST Script MENU"
PS3="Test Menu, enter choice:"
select clean_menu in "View script" "Edit script" "Print script" "Exit"
do
case $clean_menu in
"View script")
pg test.ksh;;
"Edit script")
vi test.ksh;;
"Print Report")
lp test.ksh;;
"Exit") break ;;
esac
done
_____
This will look like this when ran!
TEST Script MENU
1) View script
2) Edit script
3) Print script
4) Exit
Test Menu, enter choice:
this a super basic menu driven script.
_____
PS3= : what will show at the bottom, usually i have the name of the script (in my example, Test Menu, enter choice:)
select case_menu ... : can be whatever you choose to be, just be sure you reference the same name in the: case $clean_menu in
The options after the select case_menu : they are the menu options that will show up. You need to have these match up with the references to them in the latter part of the script.
Always close each command with: ;; (you need 2!)
Best advice is to start with a very simple script and learn how that works. Then once you get the basics, you can start creating submenus, or have menu options that will call other scripts or menus or even have your script call functions you create with in the script.
Subscribe to the Tech-Recipes Newsletter
You can get tips like this delivered in your email every week!
We will never, ever sell your email address or spam you.
Related recipes:
Reading a list of data into a function using a script.
Set an environment variable in Korn shell (ksh)
Checking if a variable is a number in ksh
appending a list of files to one file using xargs command
Some Common AIX/Unix Commands
Enable vi ksh command line editing
Sponsored links
Login
Don't have an account yet? You can create one. As a registered user you have some advantages like theme manager, comments configuration and post comments with your name.Search
Tech Recipes
· Home
· Mac OS X
· Solaris
· Windows
· Programming
· UNIX
· Cisco
· MySQL
· Google
· Instant messaging
· Add recipes
· Leave feedback
· Recommend us
· RSS Syndication
Hot recipes
XP: Small, Free Way to Use and Mount Images (ISO files) Without Burning Them
Make XP look like Windows Vista / Longhorn for free!
Vista: Should I Install 64-bit or 32-bit Version? (x64 vs x86)
Hacks to Beat Rapidshare Download Limits and Waiting Time
How Do I Use or Open Bin, Cue, or ISO Files?
SMS through E-Mail: Cingular, Nextel, Sprint, T-Mobile, Verizon, Virgin Mobile
MySpace Hack: View Pictures and Comments on a Private Profile
MySpace: Hack to Dowload Any Song on Myspace
Who's Online
There are currently, 1930 guest(s) and 1 member(s) that are online.
You are Anonymous user. You can register for free by clicking here
Information
Wish to advertise with us?
All logos and trademarks in this site are property of their respective owner. The comments and forum posts are property of their posters, all the rest © 2003-2007 by QD Ideas, LLC.
Users of this site are legally bound by the Terms and conditions and Disclaimer. Do not use this web site if you do not agree with these policies.
The members, admins, and authors of this website respect your privacy.
Page Generation: 0.73 Seconds
Sun Sep 7 18:06:01 2008