Variables
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.
Literals
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
\t
tab
\r
carriage return
\n
new line
\0
string end
\\
backslash
Examples
42
98.6
‘string literal’
“ count”
“ \t this string starts with a tab and ends with a tab \t”
Operators
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
Operators
Operation Type
truncate()
round()
rand()
substr()
Extraction
465
Copyright © 2010, Juniper Networks, Inc.
Chapter 8: Writing CLI Macros
Summary of Contents for JUNOSE 11.3
Page 6: ...Copyright 2010 Juniper Networks Inc vi...
Page 8: ...Copyright 2010 Juniper Networks Inc viii JunosE 11 3 x System Basics Configuration Guide...
Page 24: ...Copyright 2010 Juniper Networks Inc xxiv JunosE 11 3 x System Basics Configuration Guide...
Page 32: ...Copyright 2010 Juniper Networks Inc 2 JunosE 11 3 x System Basics Configuration Guide...
Page 146: ...Copyright 2010 Juniper Networks Inc 116 JunosE 11 3 x System Basics Configuration Guide...
Page 166: ...Copyright 2010 Juniper Networks Inc 136 JunosE 11 3 x System Basics Configuration Guide...
Page 432: ...Copyright 2010 Juniper Networks Inc 402 JunosE 11 3 x System Basics Configuration Guide...
Page 488: ...Copyright 2010 Juniper Networks Inc 458 JunosE 11 3 x System Basics Configuration Guide...
Page 524: ...Copyright 2010 Juniper Networks Inc 494 JunosE 11 3 x System Basics Configuration Guide...
Page 554: ...Copyright 2010 Juniper Networks Inc 524 JunosE 11 3 x System Basics Configuration Guide...
Page 566: ...Copyright 2010 Juniper Networks Inc 536 JunosE 11 3 x System Basics Configuration Guide...
Page 588: ...Copyright 2010 Juniper Networks Inc 558 JunosE 11 3 x System Basics Configuration Guide...
Page 613: ...PART 3 Index Index on page 585 583 Copyright 2010 Juniper Networks Inc...
Page 614: ...Copyright 2010 Juniper Networks Inc 584 JunosE 11 3 x System Basics Configuration Guide...
Page 632: ...Copyright 2010 Juniper Networks Inc 602 JunosE 11 3 x System Basics Configuration Guide...