shopt-option

direxpand shell option

During interactive filename completion, substitutes expanded directory names into the editing buffer rather than trying to preserve the original spelling. For example, a variable naming a directory may become the actual path. Fixture verifies state; a separate PTY test checks directory expansion. 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 direxpand; shopt -u direxpand

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 direxpand || exit 1shopt -q direxpand || exit 1shopt -u direxpand || exit 1if shopt -q direxpand; then exit 1; fiprintf "enabled then disabled\n"
Bash Reference