What's a expect?
1Expect isA tool for Automating Interactive ApplicationsSuch astelnet, FTP,2passwd, fsck, rlogin, Tip, etc. Expect really makes Thisstuff trivial. Expect3 isAlso useful fortesting these same applications. and by adding Tk, you4can also wrap interactive applicationsinchX11 GUIs.5 6 Expect can make easy all sorts of the tasks that is prohibitively difficult with7AnythingElse. You'll find that Expect isAn absolutely invaluable tool-8 usingIt, you'll be the able to automate tasks've never even9Thought of Before-and you'll be able to does this automation quickly andTenEasily.
Expect is a tool for building interactive automation (TELNET,FTP, etc.) that can be built with TK X11gui.expect to automate and simplify the work of your daily interactions. (The network device is tested under the CLI).
Two-Installation
Expect based on TCL (nostalgia for the previous TCL,ATF Ah, time too fast, blink fast for 1 years)
Unix System Installation Yum-y install TCL expect-in expect
Windows installation http://www.activestate.com/activetcl/downloads download your own version
Switch to your directory tcl/bin/, Python package management is Easy_install and Pip, Tcl's package management tool is teacup
This problem occurs
1C:\windows\system32>Teacup.exe Install Expect2Resolving Expect ... Not foundinchThe archives.3 4While a more fuzzy search disregarding Caseand accepting5 substrings was did, we is sorry to say that it yielded no possible6Candidates forinstallation either.7 8 Questions to consider:9Have you spelled the name correctly?Tenincluding the proper Caseof characters? One ANote that Teacup's'Search'command allows locate packages by - subject, categories, and the like. - the - aborting installation, was wasn't able to locate the requested -Entity.
Find not found, the official website looked under, there is no x64 version, x86 or 5.43 version. In addition tcl85 to control the size of the packet, removed the expect. 84 built-in Expect, script head package require Expect. Want to use in win or 84.
Three examples
1. Write a ping tcl script
Run results
2. Write a expect
Run results
You must give execution permission before the script runs.
Expect example is not good, you can write a mock smtp163 like practiced hand
Syntax Reference:
http://www.tcl.tk/man/tcl8.5/tutorial/
http://expect.sourceforge.net/
This site blog is original, reproduced please indicate the source, small three ye thanked ~~!
Expect interactive automation scripts