variable
COMP_LINE
The complete current input line, available inside programmable completion functions and invoked external completion commands. It includes text outside the word currently being completed. 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=bm_demo al.
Formal Syntax & Structure
bash syntaxbash
COMP_LINEReturn 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_LINE"; COMPREPLY=(alpha); }complete -F _bm_complete bm_demo# Type bm_demo al then press Tab, then Enter.