Expect是在Tcl的基础上创建的,可以用来做一些Linux下无法做到交互的命令操作,可用于远程管理服务器。
一、安装Tcl:
1.下载源码包:
wget http://nchc.dl.sourceforge.net/sourceforge/tcl/tcl8.4.11-src.tar.gz
2.解压缩源码包:
tar xfvz tcl8.4.11-src.tar.gz
3.编译安装:
cd tcl8.4.11/unix
./configure --prefix=/usr/tcl --enable-shared
make
make install
4.安装完毕以后,进入tcl源代码的根目录,把子目录unix下面的tclUnixPort.h copy到子目录generic中。
二、安装expect:
1.下载源码包:
wget http://sourceforge.net/projects/expect/files/Expect/5.45/expect5.45.tar.gz
2.解压源码包:
tar xzvf expect5.45.tar.gz
3.安装配置:
cd expect5.45
./configure --prefix=/usr/expect --with-tcl=/usr/tcl/lib --with-tclinclude=../tcl8.4.11/generic
make
make install
4.建立软连接:
ln -s /usr/tcl/bin/expect /usr/bin/expect