Question

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.

Was it helpful?

Solution

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
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top