문제

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