Including substitution variables in a macro
You can use substitution variables in a macro so that when you run the macro, you can provide values for items such as command parameters. When you use substitution variables, you can use a macro again and again, whenever you need to complete the same task for different objects or with different parameter values.
About this task
A substitution variable consists of a percent sign (%), followed by a unique number that identifies the substitution variable. When you run the file with the MACRO command, you must specify values for the variables.
- If your system uses the percent sign as a wildcard character, the administrative client interprets a pattern-matching expression in a macro where the percent sign is immediately followed by a digit as a substitution variable.
- You cannot enclose a substitution variable in quotation marks. However, a value that you supply as a substitution for the variable can be a quoted string.
Example
/* register new nodes */
register node %1 %2 - /* userid password */
contact=%3 - /* 'name, phone number' */
domain=%4 /* policy domain */
When you run the macro, you must enter the values that you want to pass to the server to process the command.
For example, to use the macro to register the node that is named DAVID with a password of DAVIDPW, include a name and phone number as contact information, and assign it to the DOMAIN1 policy domain, enter the following command:
macro auth.mac david davidpw "david pease, x1234" domain1