[rancid] Re: plus in the prompt?
Jethro R Binks
jethro.binks at strath.ac.uk
Tue Mar 11 09:43:51 UTC 2008
On Mon, 10 Mar 2008, Austin Schutz wrote:
> On Mon, Mar 10, 2008 at 04:53:44PM -0400, Ed Ravin wrote:
> > Looks like it's the plus sign in the prompt. If I change it to "XandY"
> > instead of "x+y" clogin works as expected.
> >
> > Why does it work for the enable and the "term length 0" command, but not
> > afterwards?
>
> Just tossing a guess out here: expect is looking for a prompt using
> a regex. The + you have in your prompt is being treated like a regex +,
> so expect is looking for a string that looks like xy or xxxy, etc.
> Probably best to not do that, if you can avoid it.
I think I am correct in saying that if you look in clogin and equivalents,
in:
proc run_commands { prompt command } {
There is code like:
# escape any parens in the prompt, such as "(enable)"
regsub -all {[)(]} $prompt {\\&} reprompt
# match cisco config mode prompts too, such as router(config-if)#,
# but catalyst does not change in this fashion.
regsub -all {^(.{1,14}).*([#>])$} $reprompt {\1([^#>\r\n]+)?[#>](\\([^)\\r\\n]+\\))?} reprompt
which on my reading seems to be escaping certain chars in reprompt so that
they aren't interpreted by expect when used later on as part of a regexp
match against input. I guess you will need to add something to escape +
characters as well, if that's what you need to use in the prompt.
Jethro.
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Jethro R Binks
Computing Officer, IT Services
University Of Strathclyde, Glasgow, UK
More information about the Rancid-discuss
mailing list