Interactive Menus With select
Offer a numbered choice list without writing menu code.
Use select opt in a b c to present numbered options and read the choice into $opt.
01Command
Command
$ select opt in start stop status; do echo "chose: $opt"; break; done02What it does
select prints a numbered menu, reads a choice and loops until you break, all built into the shell. It is handy for small admin scripts where a full TUI would be overkill, and it needs no external menu library.
03Risk
!Warning: select always reads from the terminal, so avoid it in non-interactive or piped scripts.
04Undo
✓No undo needed — this command does not change persistent state.
05Sources
- bash.1.en.html manual pageEvidence: The bash manual page documents select.
Last verified: 2026-10-13 · Category: Developer