shopt-option
assoc_expand_once shell option
On Bash 5.2, suppresses repeated evaluation of associative-array subscripts in applicable arithmetic and assignment contexts. Not a security boundary: do not evaluate untrusted arithmetic or subscript expressions. This fixture verifies option state, not the full set of expansion contexts. 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 assoc_expand_once; shopt -u assoc_expand_onceReturn 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 assoc_expand_once || exit 1shopt -q assoc_expand_once || exit 1shopt -u assoc_expand_once || exit 1if shopt -q assoc_expand_once; then exit 1; fiprintf "enabled then disabled\n"