Other solutions/languages that are superior to the TCL-based Expect? [closed]
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 9 years ago.
Improve this questionI am amazed by how Expect (TCL) can automate a lot of things I normally could not do.
I thought I could dig deeper into Expect by reading a book, but before I do that I want to ask if there are other solutions/languages that could do what Expect does?
Eg. I h开发者_如何学Goave read that people compare Expect with Awk and also Perl.
Could Awk and Perl do the same thing?
How about other languages like Python and Ruby?
Is Expect the de-facto automation tool or are there other solutions/languages that are more superior?
There's more to it.
Bluntly, the original Expect--the Tcl Expect--is the best one. It better supports "interact" and various pty eccentricities than any of its successors. It has no superior, for what it does.
HOWEVER, at the same time, most Expect users exploit such a small fraction of Expect's capabilities that this technical superiority is a matter of indifference to them. In nearly all cases, I advise someone coming from Perl to use Expect.pm, someone familiar with Python to rely on Pexpect, and so on.
Naive comparisons of Perl with "... Awk and also Perl" are ill-founded.
In the abstract, all the common scripting languages--Lua, awk, sh, Tcl, Ruby, Perl, Python, ...--are about the same. Expect slightly but very effectively extends this common core in the direction of pty-awareness (there's a little more to the story that we can neglect for the moment). Roughly speaking, if your automation involves entering an invisible password, you want Expect. Awk and Perl do NOT build in this capability.
There are other automation tools for other contexts.
Check out Expect for Perl
ajsie asks, "Which other automation tools are you talking about?"
I'll answer a different question: "which other contexts do I have in mind"? The answer: any interactive environment OTHER than a stdio one. Expect is NOT for automation of GUI points-and-clicks, for example. Expect is also not available for Win* non-console applications, even if they look as though they are character-oriented (such exist).
An exciting counter-realization: Expect is for automation of wacky equipment that permits control by a term-like connection. If your diesel engine (or, more typically, telecomm iron) says it can be monitored by hooking up a telnet-like process (even through an old-style serial line, say), you're in a domain where Expect has a chance to work its magic.
Check out Pexpect for Python
精彩评论