expect是建立在tcl基础上的一个工具,它用来让一些需要交互的任务自动化地完成。
因为expect是基于tcl的,所以需要你的系统中安装有tcl
检查系统种是否有tcl.
[root@dev ~]# whereis tcl
tcl: /usr/lib/tcl8.4 /usr/share/tcl8.4
如果看不到结果,请先安装tcl
安装tcl:
下载地址:http://nchc.dl.sourceforge.net/sourceforge/tcl/tcl8.4.11-src.tar.gz
tar -zxvf tcl8.4.11-src.tar.gz
cd tcl8.4.11/unix/
./configure
make && make install
安装expect(下载地址:http://sourceforge.net/projects/expect/files/Expect/5.45/expect5.45.tar.gz/download)
tar -zxvf expect5.45.tar.gz
cd expect5.45
./configure --with-tclinclude=/tmp/tcl8.4.11/generic --with-tclconfig=/usr/local/lib/
make && make install
检查安装情况
[root@node1 expect5.45]# expect
expect1.1>
expect1.1>
安装完成.
参考:http://blog.youkuaiyun.com/catoop/article/details/48289991
http://blog.youkuaiyun.com/silenceray/article/details/54582345