- name=value (one or more) without a command sets variables of the shell
- name=value before a command sets them only in its environment (for
builtins only while they run)
- an assignment needs an unquoted name and =; the value is not split
and not expanded as wildcard or brace pattern, ~ is expanded after =
and :
- the status of an assignment is the one of its last $(...)
- new builtin unset
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- $(command) is replaced by the output of command, which runs in a
subshell (gosh -c), so cd/set in it do not change the shell
- trailing newlines are removed; unquoted the output is split into words
at blanks and newlines, "$(...)" stays one word; wildcards in the
output are not expanded
- nested substitutions, quotes and operators inside are handled; the
list, alias and brace scanners skip $(...) as a whole
- a command that consists only of a substitution has its exit status,
Ctrl+C in a substitution aborts the command
- $((...)) is reported as not supported
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- a{b,c}d, nested braces, empty alternatives (file{,.bak})
- sequences {1..5}, {5..1}, {1..10..3}, zero-padded {01..10}, letters
{a..e}
- happens first on the command text, the results go through ~,
variable and wildcard expansion
- quoted/escaped braces, ${...} and braces without comma or valid
sequence are kept; \, protects a comma
- a redirection target must expand to one word (ambiguous redirect),
a word may expand to at most 100000 words
- completion escapes { in file names
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>