Table 51: Environment Commands
(continued)
Description
Command
Checks a string against a regular expression
env.regexpMatch(string)
Extracts a string from a larger string
env.getRegexpMatch(string)
Capturing Output of Commands
Macro language commands can start and stop the capture of JUNOSe command
output and save the results.
The env.startCommandResults command starts JUNOSe output capture and flushes
any existing capture buffer. The capture stops when directed by a
stop
command or
when the buffer maximum of 5,242,880 (5MB) characters is reached. The command
output in the buffer is stored as normally seen on the terminal output. A <CR> ends
a line of buffer data.
The env.stopCommandResults command stops JUNOSe output captures. The
env.getResults command obtains one line of output from the capture buffer.
The env.startCommandResults, env.stopCommandResults, and env.getResults
commands apply to one CLI session. There is no effect on CLI sessions other than
the CLI session running the macro.
The env.getResults command gets the next line of the capture buffer. Each call gets
the next line of the capture buffer. The command returns the first line the first time
it is called after a capture start (env.startCommandResults). It resets the next line it
returns by passing a line number argument. An argument of 0 or 1 returns the first
line.
For example:
<# env.startCommandResults #>
show version
<# env.stopCommandResults #>
! possibly other JUNOSe commands
<# while something is true #>
<# outputLine := env.getResults #>
. . .
<# endwhile #>
Adding Regular Expression Matching to Macros
Use the following syntax to check a string against a regular expression:
env.regexpMatch(stringToMatch, someRegularExpression)
For example, the string outputLine is checked to determine whether it starts with
the value System:
476
■
Writing Macros
JUNOSe 11.1.x System Basics Configuration Guide
Содержание JUNOSe 11.1
Страница 6: ...vi...
Страница 8: ...viii JUNOSe 11 1 x System Basics Configuration Guide...
Страница 24: ...xxiv List of Figures JUNOSe 11 1 x System Basics Configuration Guide...
Страница 32: ...2 Chapters JUNOSe 11 1 x System Basics Configuration Guide...
Страница 58: ...28 Configuring Remote Access JUNOSe 11 1 x System Basics Configuration Guide...
Страница 176: ...146 Downgrading JUNOSe Software JUNOSe 11 1 x System Basics Configuration Guide...
Страница 280: ...250 Monitoring SNMP JUNOSe 11 1 x System Basics Configuration Guide...
Страница 384: ...354 Monitoring the System JUNOSe 11 1 x System Basics Configuration Guide...
Страница 446: ...416 Monitoring Modules JUNOSe 11 1 x System Basics Configuration Guide...
Страница 580: ...550 Monitoring Virtual Routers JUNOSe 11 1 x System Basics Configuration Guide...
Страница 581: ...Part 2 Reference Material Abbreviations and Acronyms on page 553 References on page 571 Reference Material 551...
Страница 582: ...552 Reference Material JUNOSe 11 1 x System Basics Configuration Guide...
Страница 622: ...592 Hardware Standards JUNOSe 11 1 x System Basics Configuration Guide...
Страница 623: ...Part 3 Index Index on page 595 Index 593...
Страница 624: ...594 Index JUNOSe 11 1 x System Basics Configuration Guide...
Страница 640: ...610 Index JUNOSe 11 1 x System Basics Configuration Guide...