Bash Parameter and Variable Expansion

From NovaOrdis Knowledge Base
Revision as of 21:16, 18 September 2019 by Ovidiu (talk | contribs) (→‎Overview)
Jump to navigation Jump to search

Internal

Overview

A dollar sign ($) that is NOT followed by an open parenthesis initiates parameter or variable expansion. Parameter and variable expansion is a particular case of command line expansion: The simplest case of parameter expansion is retrieving the parameter value: the associated value is retrieved by prefixing the parameter's number, character or name with $ or enclosing it in ${...}.

Parameters and variables are not expanded if the string they are included in are enclosed within single quotes or if the leading dollar sign is escaped. Parameters and variables are expanded if the string they are included in is enclosed within double quotes.

Difference between $ and ${...}

TODO