builtin

compgen

Generate candidates from a trusted word list; returns nonzero if no matches are generated.

Formal Syntax & Structure

bash syntaxbash
compgen -W wordlist -- prefix

Return Value

exit status

Generate candidates from a trusted word list; returns nonzero if no matches are generated.

Working Example

Example Snippetbash
compgen -W 'start stop status' -- st | LC_ALL=C sort
Bash Reference