expect 常用於自動化互動式命令。安裝前通常需要先準備 tcl,再編譯 expect。
cd /export/tools/ tar -zxvf tcl8.4.19-src.tar.gz tar -zxvf expect-5.43.0.tar.gz
cd /export/tools/tcl8.4.19/unix ./configure --prefix=/usr/tcl --enable-shared make make install cp tclUnixPort.h /export/tools/tcl8.4.19/generic/
cd /export/tools/expect-5.43 ./configure --prefix=/usr/expect --with-tcl=/usr/tcl/lib --with-tclinclude=/export/tools/tcl8.4.19/generic make make install
編輯 ~/.bash_profile,加入 expect 路徑,然後生效設定:
source ~/.bash_profile
完成後即可直接呼叫 expect。