What is Variable Expansion in Bash ?

About

variable expansion is an expansion that replaces a variable expression by its value.

Example

Prerequisite: We set the value of the variable foo to bar to perform the expansion

foo=bar 



Example:

  • In the following expression that is composed of:
echo ${foo}
  • The variable expression ${foo} will be replaced / expanded by the value bar at runtime resulting to
echo bar

that outputs to the console

bar

Powered by ComboStrap