Table 51: Environment Commands
Description
Command
Causes the macro to delay further execution for the number
of seconds specified by
delay
env.delay(int
delay
)
Prompts the user with a question mark (?) and waits for a
response
env.getLine
Prompts the user with the value of
prompt-string
and waits for
a response
env.getLine(string
prompt-string
)
Prompts the user with a question mark (?), waits for a
response, and echoes the response with an asterisk (*) for
each character entered by the user
env.getLineMasked
Prompts the user with the value of
prompt-string
, waits for a
response, and echoes the response with an asterisk (*) for
each character entered by the user
env.getLineMasked(string
prompt-string
)
Returns the number of arguments passed to the macro
env.argc
Returns the value of the nth argument, such that 1 <= n <=
env.argc
The returned value is a string, not a number; if you want to use
this value for a subsequent numeric operation, you must first
convert it to a number with the env.atoi(
string
) command
env.argv(n)
Returns the name of the macro
env.argv(0)
Converts the specified string to a numeric value
env.atoi(
string
)
Converts input values to integers
env.atoi(env.argv(n))
Sets parameters within a macro for display through the
macroData log at the NOTICE severity level following the
completion of the macro
env.setResult
Returns the command string that triggered a macro error
env.getErrorCommand
Returns the reason for a triggered error
env.getErrorStatus
Starts the capture of command output
env.startCommandResults
Stops the capture of command output
env.stopCommandResults
Returns one line of output from the capture buffer
env.getResults
Checks a string against a regular expression
env.regexpMatch(string)
Extracts a string from a larger string
env.getRegexpMatch(string)
461
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...