Skip to content

Instantly share code, notes, and snippets.

@Rachitlohani
Last active August 29, 2015 14:09
Show Gist options
  • Save Rachitlohani/018b7992f356a8774ab5 to your computer and use it in GitHub Desktop.
Save Rachitlohani/018b7992f356a8774ab5 to your computer and use it in GitHub Desktop.
The order is (from first to last):
Brace expansion
Tilde expansion
The following expansions happen at the same time, in a left-to-right fashion on the commandline (see below)
Parameter expansion
Arithmetic expansion
Command substitution
Word splitting
Pathname expansion
Process substitution is performed simultaneously with parameter expansion, command substitution and arithmetic expansion. It is only performed when the underlying operating system supports it.
The 3 steps parameter expansion, arithmetic expansion and command substitution happen at the same time in a left-to-right fashion on nthe commandline. This means
i=1
echo $i $((i++)) $i
will output 1 1 2 and not 1 1 1.
URL : http://wiki.bash-hackers.org/syntax/expansion/intro
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment