Macro Expansion: $ and $&
The value of a macro can be used by putting a $
character in front of
the macro’s name. For example, consider the following
definition:
DXtext
Here, the macro named X
is given
text
as its value.
If you later prefix a macro name with a $
character, you can use
that value. This is called expanding a
macro:
$X
Here, the expression $X
tells sendmail to use the value stored
in X
(the
text
) rather than its
name (X
).
For multicharacter names, the process is the same, but the name is surrounded with curly braces:
D{Xxx}text ← declare {Xxx} ${Xxx} ← use {Xxx}
Get sendmail, 4th Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.