matching Cisco config prompt
john heasley
heas at shrubbery.net
Mon Feb 17 06:06:27 UTC 2003
Fri, Feb 14, 2003 at 10:20:15AM -0800, Rizzo, Joe:
> Ah. I see. Thanks for the explanation.
>
> Anyway, the following seems to work on Cisco routers in any config mode
> and with truncated a prompt.
>
> diff -u clogin.orig clogin
> --- clogin.orig Wed Feb 12 15:33:02 2003
> +++ clogin Fri Feb 14 10:11:04 2003
> @@ -456,9 +456,9 @@
> } else {
> send "term length 0\r"
> }
> - regsub -all "\[)(]" $prompt {\\&} reprompt
> + regsub -- {^(.{0,14}).*([#>])$} $prompt {\1\2} reprompt
> # match cisco config mode prompts too, but not for catalyst ie:
> (enable)
> - regsub -all "\[#>]$" $reprompt {(\\([^\\r\\n]+\\))?&} reprompt
> + regsub -all "\[#>]$" $reprompt {.*(\(config.*\))?&} reprompt
> expect {
> -re $reprompt {}
> -re "\[\n\r]+" { exp_continue }
i think that is real close. need to test though. thanks joe.
[ my cat5k is one weird duck...and stuck at ~ rev 2.4. trying to get
my hands on something more recent ]
More information about the Rancid-discuss
mailing list