Do-while in Expect script

后端 未结 1 1337
太阳男子
太阳男子 2021-01-14 04:50

I wrote the below code and try to execute it. But i face the \"invalid command name \"do\" while executing do {\"

code:

#!/usr/bin/expect
set val 0;
         


        
相关标签:
1条回答
  • 2021-01-14 05:06

    The short answer is no.

    The slightly longer answer is:

    while true {
        puts "\nval = $val"
        incr val
        if {[incr input -1] == 0} break
    }
    

    The full discussion can be found on the Tcl wiki.

    0 讨论(0)
提交回复
热议问题