Variables
Literals
Examples
Operators
Copyright © 2010, Juniper Networks, Inc.
A local variable enables you to store a value used by the macro while it executes. The
macro can modify the value during execution. Local variables can be integers, real
numbers, or strings. The initial value of local variables is zero.
Like macros, local variables must have a name consisting only of letters, numbers, or the
underline character (_). The variable name must not begin with a number. You must not
use a reserved keyword as a variable name. A line that ends with a variable needs a new
line character at the end of the line.
A literal is an exact representation of numeric or string values. Every number is a literal.
Place single or double quotation marks around a string to identify it as a string literal.
You can specify special characters within a literal string by prefacing them with a
backslash as follows:
quotation mark
double quotation
mark
tab
carriage return
new line
string end
backslash
42
98.6
'string literal'
" count"
" \t this string starts with a tab and ends with a tab \t"
You can use operators to perform specific actions on local variables or literals, resulting
in some string or numeric value. Table 52 on page 465 lists the available macro operators
in order of precedence by operation type. Operators within a given row are equal in
precedence.
Table 52: Macro Operators
Operation Type
Operators
Extraction
substr()
\'
\"
\t
\r
\n
\0
\\
rand()
round()
truncate()
Chapter 8: Writing CLI Macros
465
Need help?
Do you have a question about the JUNOSE SOFTWARE FOR E SERIES 11.3.X - SYSTEM BASICS CONFIGURATION GUIDE 2010-10-04 and is the answer not in the manual?