I want to do the following in expect, but I cannot find documentation that either shows how to do this or explains that it cannot be done.

I want to have a set or array of words, eg: "pig", "chicken", "house", "room"

I then want to run the same command for every word, eg: "delete $word"

I assume this has to be done in a foreach loop, but both Google and Bing refuse to show me any links that have both the word "expect" and "foreach" on the same page. Any pointer to the documentation will be greatly appreciated.

有帮助吗?

解决方案

Expect is a Tcl extension, so the Tcl documentation is highly relevant: http://tcl.tk/man/tcl8.5/TclCmd/contents.htm

foreach word {pig chicken house room} {
    delete $word
}
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top