matching Cisco config prompt

Rizzo, Joe JRizzo at ea.com
Fri Feb 14 18:20:15 UTC 2003


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 }

Thanks,
Joe




More information about the Rancid-discuss mailing list