set-option

Bash set -o braceexpand

Controls brace expansion, a textual generation stage that precedes parameter expansion. Disabling it preserves brace syntax as ordinary text. Bash extension; not a portable sh feature. Run in a fresh private directory with HOME set to that directory and LC_ALL=C. Expected output (one item per line): [item1]; [item2]; [item{1,2}].

Formal Syntax & Structure

bash syntaxbash
set -o braceexpand; set +o braceexpand

Return Value

exit status

Option-setting command returns zero for a valid request; query status is zero if enabled, one if disabled.

Working Example

Example Snippetbash
set -o braceexpandprintf '[%s]\n' item{1,2}set +o braceexpandprintf '[%s]\n' item{1,2}
Bash Reference