René Nyffenegger's collection of things on the web
René Nyffenegger on Oracle - Most wanted - Feedback -
 

shell: select

select var in Apples Pears Oranges Lemons
do
  # do something
  # $var is one of Apples, Pears, Oranges or Lemons
  # 
  # leave the select construct with one of break, return or exit
done
displays
1) Apples
2) Pears
3) Oranges
4) Lemons
#?
and lets the user choose one option. The number of the chosen item is stored in $REPLY
The following construct
select var
is equivalent to
select in "$@"

Availablity

Select is available in the ksh.