Actually, I don't think you can. From what I know, cmd() matches against the prompt. That's fine if the first time you see a prompt, it's been matched against a specific cmd or other call. What I'm talking about isn't the possibility of matching against a funky new prompt or something, which I kinda think is what you're suggesting. The problem I have is that there's a prompt which comes up *the second* I connect to the device. In other words, there's no way I can match against it and remove it from the buffered stream. And clearing the buffer doesn't beat that in my experience either.
When you capture the output from a 'cmd()' the way it seems to work is that it reads the buffer of everything which has occurred in the telnet session so far. That buffer is matched against for every call made against the router, and every prompt is accordingly dealt with. So if you have a prompt appearing anywhere in the stream and it's not been matched, then all of your matched output will be one prompt behind.
Sorry if you're dead right and I've missed it, but I can't see what the prompt documentation provides for other than matching against a given string.
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.
|