shopt-option
no_empty_cmd_completion shell option
Prevents Bash from searching PATH for command completions on an empty line when completion is requested. It does not disable completion of a nonempty prefix or all filename completion. The example checks state only. Run in a fresh private directory with HOME set to that directory and LC_ALL=C. Expected output (one item per line): enabled then disabled.
Formal Syntax & Structure
bash syntaxbash
shopt -s no_empty_cmd_completion; shopt -u no_empty_cmd_completionReturn Value
exit status
Returns zero on success and nonzero on failure; option queries return zero when enabled.
Working Example
Example Snippetbash
shopt -s no_empty_cmd_completion || exit 1shopt -q no_empty_cmd_completion || exit 1shopt -u no_empty_cmd_completion || exit 1if shopt -q no_empty_cmd_completion; then exit 1; fiprintf "enabled then disabled\n"