Bash Parameter and Variable Expansion: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
Line 2: Line 2:


* [[Bash_Parameters_and_Variables#Parameter_and_Variable_Expansion_-_Accessing_a_Parameter.27s_or_Variable.27s_Value|bash Parameters and Variables]]
* [[Bash_Parameters_and_Variables#Parameter_and_Variable_Expansion_-_Accessing_a_Parameter.27s_or_Variable.27s_Value|bash Parameters and Variables]]
* [[Bash_Command_Line_Expansion#|bash Command Line Expansion]]


=Overview=
=Overview=

Revision as of 21:17, 18 September 2019

Internal

Overview

A dollar sign ($) that is NOT followed by an open parenthesis initiates parameter or variable expansion, which 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