Table of Contents

Variable expansion is a powerful and important Bash feature. It allows for more advanced, convenient manipulation of text without invoking another process. Some expansion types will only work for newer versions of Bash. These limitations are noted where relevant.

:!: Note: Each type of expansion is described in the order that Bash interprets it.

Brace Expansion

Bash 4+

Tilde Expansion

"PPAC" Operations

These operations all occur at the same time, in left-to-right order:

Parameter Expansion

Process Substitution

Compatibility depends on OS. It's used to avoid subshells, or use the filesystem as an API.

Arithmetic Expansion

Command Substitution

Word Splitting

Path Name Expansion

References

Bash Hacker's Wiki – Expansion Intro