First page Back Continue Last page Graphics
The select statement (Pages 912)
Creating interactive text menus is much simplified by using the select loop and the PS3 prompt.
select variable in wordlist; do ... done
Each item in wordlist (use quotes if an item includes blanks) is sent to stderr (not stdout) with a sequential number to its left, after a PS3 prompt.
The number selected by the user is stored in the REPLY variable (like read) and the corresponding word is placed in variable.
Use a case or an if-elif to check the menu input.
Because select is a loop control, the break command must used to exit from it (or exit to end the script). There is no ending condition as there is in for, while, and until.
Choose your prompt and set PS3 before your select.