Re: How to control the loop within expect.
Available news archives: comp.lang.tcl - comp.lang.python - comp.security.firewalls - sci.crypt - comp.lang.php - comp.lang.javascript
Google
 
Web news.hping.org


comp.lang.tcl archive

Re: How to control the loop within expect.

From: Gerald W. Lester <Gerald.Lester@cox.net>
Date: Sat Apr 29 2006 - 07:13:13 CEST

Hu Junfeng wrote:
> Bruce Hartweg 写道:
> ...
> Thanks, it works:)
> But I find another problem with it ,if I put the continue in a
> procedure, it will not works again. for example:

Read the man/help page on the return command.

> proc CMD {con} {
> upvar CMDSUCC CMDSUCC
> upvar CMDFAIL CMDFAIL
> send -i $con "cd /nodes\r"
> expect {
> -i $con
> $CMDSUCC {
> puts "succe"
> continue
> }
> $CMDFAIL {
> puts "fail"
> continue
> }
> }
> puts "123"
> }
>
>
>
> set i 0
> if {$i==0} {
> foreach $i {1 2 3 4 5} {
> CMD $CLICom
> }
> } else {
> puts "hehe"
> }
>
>
> the result is
> invoked "continue" outside of a loop
>

-- 
+--------------------------------+---------------------------------------+
| Gerald W. Lester                                                       |
|"The man who fights for his ideals is the man who is alive." - Cervantes|
+------------------------------------------------------------------------+
Received on Sun Apr 30 03:31:15 2006