shopt-option

hostcomplete shell option

Allows hostname completion for eligible words beginning with @. Hostname data may depend on HOSTFILE or configured sources. This fixture tests option state only and does not resolve or contact any host. 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 hostcomplete; shopt -u hostcomplete

Return Value

exit status

Setting or clearing an available option succeeds; a query returns zero when enabled and one when disabled.

Working Example

Example Snippetbash
shopt -s hostcomplete || exit 1shopt -q hostcomplete || exit 1shopt -u hostcomplete || exit 1if shopt -q hostcomplete; then exit 1; fiprintf "enabled then disabled\n"
Bash Reference