variable
COMP_TYPE
An integer encoding the kind of completion request. Normal Tab completion is represented by the character code for Tab; other requests can have different values. This fixture records the value inside the completion callback; it is not an ordinary persistent variable. Run in a fresh private directory with HOME set to that directory and LC_ALL=C. Use interactive Bash with default key bindings; expected visible result: BM_VALUE=9.
Formal Syntax & Structure
bash syntaxbash
COMP_TYPEReturn Value
shell variable
Expansion yields the current value in its applicable context, not a separate command exit status.
Working Example
Example Snippetbash
# In fresh interactive Bash, enter:bm_demo() { :; }_bm_complete() { printf "\nBM_VALUE=%s\n" "$COMP_TYPE"; COMPREPLY=(alpha); }complete -F _bm_complete bm_demo# Type bm_demo al then press Tab, then Enter.