Index of Section 1 Manual Pages
| Interix / SUA | select.1 | Interix / SUA |
select(1) select(1)
select
NAME
select - display a menu
SYNOPSIS
select name [ in word ... term ] do list done
DESCRIPTION
This command is a Korn-shell built-in command.
The select(1) command provides an automatic method of presenting the user
with a menu and selecting from it.
The term argument is either a newline or a semicolon (;). An enumerated
list of the specified words is printed on standard error, followed by a
prompt (PS3, normally '#? '). A number corresponding to one of the
enumerated words is then read from standard input, name is set to the
selected word (or is unset if the selection is not valid), REPLY is set to
what was read (leading/trailing space is stripped), and list is executed.
If a blank line (that is, zero or more IFS characters) is entered, the
menu is reprinted without executing list.
When list completes, the enumerated list is printed if REPLY is null, the
prompt is printed, and so on. This process is repeated until an end-of-
file is read, an interrupt is received, or a break statement is executed
inside the loop.
If in word ... is omitted, the positional parameters are used (such as
"$1", "$2").
For historical reasons, open and close braces can be used instead of do
and done (for example, select i; { echo $i; }).
The exit status of a select statement is zero if a break statement is used
to exit the loop; otherwise, it is non-zero.