variable
COMP_WORDS
Tokenized command words available in completion context. The example provides a synthetic array.
Formal Syntax & Structure
bash syntaxbash
${COMP_WORDS[@]}Return Value
word array
Tokenized command words available in completion context. The example provides a synthetic array.
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[@]}"