The following types of expansions are performed in the indicated order in five steps:
This is performed only in interactive shells.
Aliases are expanded immediately before the command line is parsed as explained in Aliasing.
These five are performed in left-to-right fashion. On each argument,
any of the five steps that are needed are performed one after the other.
Hence, for example, all the parts of parameter expansion are completed
before command substitution is started. After these expansions, all
unquoted occurrences of the characters ‘\
’,‘'
’ and ‘"
’ are
removed.
If the SH_FILE_EXPANSION
option is set, the order of expansion is
modified for compatibility with sh and ksh. In that case
filename expansion is performed immediately after alias expansion,
preceding the set of five expansions mentioned above.
This expansion, commonly referred to as globbing, is always done last.
The following sections explain the types of expansion in detail.