Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Expect / ssh if Permission denied is received.

Status
Not open for further replies.

brittany1

Technical User
Aug 17, 2007
12
US




I am having a problem figuring out how to handle an error condition.
if the password is not accepted and I receive a Permission denied.
That condition could be met in any of the possibilities.

tks in advance for help




Code:
{
                "yes/no"        {
                                send  "yes\n"
                                expect -re "assword"
                                send  "$tacpswd\r"
                                }
                "sername"       {
                                send  "$taclnam\r"
                                expect -re "assword" {
                                                send  "$tacpswd\r"
                                        }
                                }
                "assword"       {
                                 send  "$tacpswd\r"
                                 expect ">"
                                 send "enable\n"
                                 expect "assword:"
                                 send "$tacpswd\n"
                                }
                default         {
                                puts "Login FAILED\N"
                                continue
                                #exit
                                }
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top