-
Notifications
You must be signed in to change notification settings - Fork 218
Variable expansion
Positional parameter or the console command-line argument is an entity that store value. It can be a name, a number or a string. A variable is a parameter denoted by a name.
The ‘$’ character introduces parameter expansion. The parameter name or symbol to be expanded may be enclosed in braces.
The basic form of parameter expansion is ${parameter}. The value of parameter is substituted. The braces are required when parameter is followed by a character that is not to be interpreted as part of its name.
In addition to the console script and command-line argument expansion is done also in command/pipe aliases. In console script alias
command must use an alternate character '%' to introduce parameter expansion:
alias xargs '|; %{0} %{1} %{2} %{3} %{4} %{5} %{6} %{7} %{8} %{9}'
Expands to the parameter. When there is no parameter. ${parameter} expand to nothing.
If parameter is unset or null, the expansion of word is substituted. Otherwise, the value of parameter is substituted.
Expands to the positional parameters. When there are no positional parameters, ${@} expand to nothing (i.e., they are removed).