select <NAME>; do <LIST> done
select <NAME> in <WORDS>; do <LIST> done
This compound command provides a kind of menu. The user is prompted with a numbered list of the given words, and is asked to input the index number of the word. If a word was selected, the variable <NAME> is set to this word, and the list <LIST> is executed.
If no in <WORDS> is given, then the positional parameters are taken as words (as if in “$@” was written).
Regardless of the functionality, the number the user entered is saved in the variable REPLY.