cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1063
Views
0
Helpful
22
Replies

cisco IOS device prompt

eliaspaulos
Level 1
Level 1

Hello all Cisco Managment guru! I have a script manuplating cisco device information. I use the log in with read and write privilege and the prompt was " # " now I have changed the privilege to read only and I got ">" prompt and my script can not understand and unable access the device. anybody solve this kind of issue before, how I can write expect script for this prompt.please share your solution

1 Accepted Solution

Accepted Solutions

Wasn't able to test it, but try this.

View solution in original post

22 Replies 22

Joe Clarke
Cisco Employee
Cisco Employee

If the language is expect, you can use this syntax to match either a '#' or a '>' prompt:

-re {(.*)[#>]$}

thank you so much J. some reason didn't work. little explanation about my script. it is a cgi ssh expect script. use for log in a Cisco Device using ssh. this ">" prompt not affecting a device using Telent only a device using ssh since using expect script for ssh log in. may be need to put on specific line on the script? like on the bottom or in the top the script.I have attached my expect script. any advice highly appreciated.

It would be helpful if you posted the script.

here is the script, thank you J.

Try this one.

1000000 thank you, it's working great, the minor thing is when I sent you the expect script not pasted the whole line, some expect line for access point missing.I want added that too on new expect but some reason cause the problem.

I have attached the few lines which was missing earlier. if you have time please any suggestion.

You don't need either of these blocks anymore. What error do you get trying to access an AP?

thanks J. all commands working on AP's now except "show dot11 association" this command is not working from ">" prompt? because it was working from # prompt. just curios, why only the dot11 association bring no result.

The command appears to be allowed under disable mode. What error are you getting from the expect script? Are you sure there are clients associated with this AP?

J. actually another expect script for AP's. I have attached it. that one I thinh need to add the same thing like the previous expect script.where is the good place to add the line you sent me earlier

Wasn't able to test it, but try this.

everything is working perfect Now!!! thank you so................much!!!! have a great weekend.

Hi J. Weeks back you helped me about a script to handle privilege mode prompt.(>) it works greatly but for CatOS device the prompt is the same but little bit different as you know.IOS privilege prompt >..... but on CatOs privilege prompt >(space)..... so how I can altered the script to handle this space.

or do I need to start new thread?

my expect currently include.

expect {

-re "\[#>]$" {send "term len 0\r"}

timeout {puts "Error reading prompt -> $expect_out(buffer)";exit}

}

expect {

-re "\[#>]$" {send "$command\r"}

timeout {puts "Error reading prompt -> $expect_out(buffer)";exit}

}

expect -re "\[#>]$"

set output $expect_out(buffer)

Change your regular expressions to:

"\[#>] ?$"

Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community: