Date: May 11, 2000
The Korn shell select command can be used to create a selection menu. To illustrate, the attached shell script generates the following selection menu for a hypothetical operator console:
XYZ Operator Console
1) SystemBackup
2) ListActiveUsers
3) ManageDatabase
4) MonitorPerformance
5) Quit
Choose a number:
#!/usr/bin/ksh # Shell script to illustrate the use of # the Korn shell "select" command # to create selection menus # B.Spencer 5/11/00 echo "XYZ Operator Console" echo # PS3 is an environment variable # that sets the menu prompt PS3="Choose a number: " # The select command creates the menu select CHOICE in SystemBackup ListActiveUsers ManageDatabase MonitorPerformance Quit do case $CHOICE in SystemBackup) mksysb -i /dev/rmt0;; ListActiveUsers) who;; ManageDatabase) svrmgr;; MonitorPerformance) topas;; Quit) exit;; *) echo "\nInvalid Choice\n";; esac done