Technical data
8. Documentation for Developers
Then the character strings are rewritten as follows, if variable substitution is active in this
context:
"My router is called $HOSTNAME"
# --> "My router is called fli4l"
"HOSTNAME is part of the package %{HOSTNAME}"
# --> "HOSTNAME is part of the package base"
"@HOST_N is $HOST_N"
# --> " # Number of hosts is 1"
As you can see, there are basically three options for replacement:
• $<Name> resp. ${<Name>}: Replaces the variable name with the contents of the variable.
This is the most common form of replacement. The name must be enclosed in {...}
if in the string it is directly followed by a char that may be a valid part of a variable
name (a letter, a digit, or an underscore). In all other cases, the use of curly brackets is
possible, but not mandatory.
• %<Name> resp. %{<Name>}: Replaces the variable name with the name of the package in
which the variable is defined. This does not work with variables assigned in the script
via set (Page 303) or with counting variables of a foreach-loop (Page 309) since such
variables do not have a package and their syntax is different.
• @<Name> resp. @{<Name>}: Replaces the variable name with the comment noted in the
configuration after the variable. Again, this does not make sense for variables defined by
the script.
Hint: Elements of array variables can not be integrated into strings this way, because there
is no possibility to provide an index.
In general, only constants can be used for variable substitution, strings that come from a
variable remain unchanged. An example will make this clear - assume the following configura-
tion:
HOSTNAME='fli4l'
TEST='${HOSTNAME}'
This code:
warning "${TEST}"
leads to the following output:
Warning: ${HOSTNAME}
It will not display:
Warning: fli4l
In the following sections it will be explicitly noted under which conditions strings are subject
of variable substitution.
301










