11-06-2008 12:34 PM
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
Solved! Go to Solution.
11-07-2008 01:13 PM
11-06-2008 03:07 PM
If the language is expect, you can use this syntax to match either a '#' or a '>' prompt:
-re {(.*)[#>]$}
11-07-2008 07:46 AM
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.
11-07-2008 07:53 AM
It would be helpful if you posted the script.
11-07-2008 07:56 AM
here is the script, thank you J.
11-07-2008 10:20 AM
11-07-2008 11:49 AM
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.
11-07-2008 11:53 AM
You don't need either of these blocks anymore. What error do you get trying to access an AP?
11-07-2008 12:13 PM
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.
11-07-2008 12:42 PM
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?
11-07-2008 01:06 PM
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
11-07-2008 01:13 PM
11-07-2008 01:40 PM
everything is working perfect Now!!! thank you so................much!!!! have a great weekend.
12-22-2008 08:20 AM
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)
12-22-2008 08:22 AM
Change your regular expressions to:
"\[#>] ?$"
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: