Re: Using expect with telnet menu
- From: Glenn Jackman <glennj@xxxxxx>
- Date: 30 Oct 2007 03:24:22 GMT
At 2007-10-29 07:59PM, "dgl" wrote:
I am trying to write a script to telnet from a power broker jumpbox to
a host. The hosts are listed in a numbered menu that changes
periodically. The list below is similar to my actual list. If i want
to log into host pear.domain.com, I would select "3". If the list is
modified, pear may become option 4 or 2. How can I have expect match
pear.domain.com and return it's current menu option?
==============================================================================
Power Broker Access
==============================================================================
1 apple.domain.com 3 pear.domain.com 5
cherry.domain.com
2 orange.domain.com 4 banana.domain.com 6 lime.domain.com
==============================================================================
Please choose a system:
Untested:
expect {
-re {(\d+)\s+pear\M} {
set pear_num $expect_out(1,string)
exp_continue
}
-re {Please choose a system:}
}
if { ! [info exists pear_num]} {
error "No fruit for you! Got the prompt without finding a pear"
}
exp_send -- "$pear_num\r"
--
Glenn Jackman
"You can only be young once. But you can always be immature." -- Dave Barry
.
- Follow-Ups:
- Re: Using expect with telnet menu
- From: dgl
- Re: Using expect with telnet menu
- References:
- Using expect with telnet menu
- From: dgl
- Using expect with telnet menu
- Prev by Date: Wholesale newest christmas products..Wholesale Handbags Sneakers, Wholesale Jordans Shoes Wholesale ...from www.nikekickcooc.om
- Next by Date: wiki.tcl.tk/4 - great job!
- Previous by thread: Using expect with telnet menu
- Next by thread: Re: Using expect with telnet menu
- Index(es):
Relevant Pages
|