Thomas Pavick
Thomas Pavick

Reputation: 1

Shell Substitution Precedence

I get tripped up on the sequence of substitutions shell does. I understand shell will do variable substitution before file substitution, which is done before the command line is parsed. Shell can do many different substitutions. I just don't know which is done first, second, third, and so forth. Does anyone have a precedence chart of shell substitutions?

Upvotes: 0

Views: 212

Answers (1)

kojiro
kojiro

Reputation: 77107

From man (1) bash:

The order of expansions is: brace expansion, tilde expansion, parameter, variable and arithmetic expansion and command substitution (done in a left-to-right fashion), word splitting, and pathname expansion.

Upvotes: 4

Related Questions