130 likes | 299 Views
Introduction to Expect. Speaker : Wei-Lin Chen Date : 98/5/21. Outline. Introduction Example Command Autoexpect Used expect in Windows Demo. Introduction. Unix automation and testing tool Extension to the TCL scripting language Interactive application telnet, ftp, ssh, etc.
E N D
Introduction to Expect Speaker : Wei-Lin Chen Date : 98/5/21
Outline • Introduction • Example • Command • Autoexpect • Used expect in Windows • Demo
Introduction • Unix automation and testing tool • Extension to the TCL scripting language • Interactive application • telnet, ftp, ssh, etc. • Regular expression
Example • ftp session (manual) • ftp <host> • Name : <name> • Password : <password> • ftp>put <file>
Example(cont.) • ftp session (automated) • ./ftp.exp <host> <file>
Command • Spawn • Establish application session • Set • Set variable • Expect • Expected events • Send • Send string
Command(cont.) • Puts • Output string • Interact • Pass control from script to user • For, while, if…else, etc.
Autoexpect • autosexpect ftp <host> • Name : <name> • Password : <password> • ftp>put <file> • ftp>bye • autoexpect done, file is script.exp
Used expect in Windows • Install Cygwin • Category Interpretersexpect • Execute Cygwin Bash Shell
Demo • vim ftp.exp • chmod +x ftp.exp • ./ftp.exp 10.10.21.115 Spongebob.jpg
Reference • Expect – Wikipedia • http://en.wikipedia.org/wiki/Expect • Expect Tutorial • http://users.csc.calpoly.edu/~dbutler/tutorials/winter96/expect/tutorial.html • Cygwin Note • http://irw.ncut.edu.tw/peterju/cygwin.html • Regular Expression • http://en.wikipedia.org/wiki/Regular_expression