variable

COMPREPLY

Array from which Bash reads completion function results. Example uses synthetic context, not real terminal completion.

Formal Syntax & Structure

bash syntaxbash
COMPREPLY=(candidate ...)

Return Value

candidate array

Array from which Bash reads completion function results. Example uses synthetic context, not real terminal completion.

Working Example

Example Snippetbash
_bm_complete() {    local word candidate    word=${COMP_WORDS[COMP_CWORD]}    COMPREPLY=()    for candidate in start stop status; do        [[ $candidate == "$word"* ]] && COMPREPLY+=("$candidate")    done    return 0}complete -F _bm_complete bmtoolCOMP_WORDS=(bmtool sta)COMP_CWORD=1_bm_completeprintf '%s\n' "${COMPREPLY[@]}"
Bash Reference