Linux Tcl和Expect的安装

一、先安装Tcl
1、下载:tcl版本 8.4.19
http://sourceforge.net/projects/tcl/files/Tcl/8.4.19/tcl8.4.19-src.tar.gz/download

2、解压缩源码包
tar xfvz tcl8.4.19-src.tar.gz

3、安装配置
#cd tcl8.4.19/unix
#./configure --prefix=/usr/local/tcl --enable-shared
#make
#make install

4、子目录unix下面的tclUnixPort.h 复制到generic中
#cp tcl8.4.19/unix/tclUnixPort.h tcl8.4.19/generic/

5、创建软链接
#ln -s /usr/local/tcl/bin/tcl8.4 /usr/bin/tclsh

二、后安装expect
1、下载expect版本5.43:
http://download.chinaunix.net/download/0003000/2845.shtml

2、解压缩源码包
tar -xvf expect5.43.tar.gz

3、安装配置
#cd expect5.43
#./configure --prefix=/usr/local/expect --with-tcl=/usr/local/tcl/lib --with-tclinclude=../tcl8.4.19/generic
#make
#make install
#ln -s /usr/local/tcl/bin/expect /usr/local/expect/bin/expect

5、创建链接到/bin下
#ln -s /usr/local/expect/bin/expect /usr/bin/expect
注意:如果已经存在/usr/bin/expect,请备份原来的expect文件,再删除,然后创建expect的软链接

三、完成,测试
  #expect
  expect1.1>

原文地址:https://www.cnblogs.com/zhanggaofeng/p/6804482.html