1. 程式人生 > >linux expect簡介及安裝

linux expect簡介及安裝

簡介:       

        我們通過Shell可以實現簡單的控制流功能,如:迴圈、判斷等。但是對於需要互動的場合則必須通過人工來干預,有時候我們可能會需要實現和互動程式如telnet伺服器等進行互動的功能。而Expect就是用來實現這種功能的工具。

  Expect是一個免費的程式設計工具語言,用來實現自動和互動式任務進行通訊,而無需人的干預。Expect的作者Don Libes在1990年開始編寫Expect時對Expect做有如下定義:Expect是一個用來實現自動互動功能的軟體套件 (Expect is a software suite for automating interactive tools)。系統管理員使用它可以建立指令碼對命令或程式提供輸入,而這些命令和程式是期望從終端(terminal)得到輸入,一般來說這些輸入都是手工進行輸入的。 Expect則可以根據程式的提示模擬標準輸入提供給程式需要的輸入來實現互動程式執行。

        簡單來說就是指令碼幫助你輸入本該由你自己手動輸入的資訊。

安裝:

-rw-r--r-- 1 ddd ddd  525572 2011-09-15 expect.tar.gz
-rw-r--r-- 1 ddd ddd 3641017 2011-09-15 tcl8.4.16-src.tar.gz
tar -xzvf解壓

Expect需要Tcl程式語言的支援,要在系統上執行Expect必須首先安裝Tcl

安裝tcl:

[[email protected] zx]$ cd /home/zx/tcl8.4.16/unix

通過該命令可以檢視安裝引數:

[[email protected]
unix]$./configure --help Usage: configure [options] [host] Options: [defaults in brackets after descriptions] Configuration:   --cache-file=FILE       cache test results in FILE   --help                  print this message   --no-create             do not create output files   --quiet, --silent       do not print `checking...' messages   --version               print the version of autoconf that created configure Directory and file names:   --prefix=PREFIX         install architecture-independent files in PREFIX                           [/usr/local]   --exec-prefix=EPREFIX   install architecture-dependent files in EPREFIX                           [same as prefix]   --bindir=DIR            user executables in DIR [EPREFIX/bin]   --sbindir=DIR           system admin executables in DIR [EPREFIX/sbin]   --libexecdir=DIR        program executables in DIR [EPREFIX/libexec]   --datadir=DIR           read-only architecture-independent data in DIR                           [PREFIX/share]   --sysconfdir=DIR        read-only single-machine data in DIR [PREFIX/etc]   --sharedstatedir=DIR    modifiable architecture-independent data in DIR                           [PREFIX/com]   --localstatedir=DIR     modifiable single-machine data in DIR [PREFIX/var]   --libdir=DIR            object code libraries in DIR [EPREFIX/lib]   --includedir=DIR        C header files in DIR [PREFIX/include]   --oldincludedir=DIR     C header files for non-gcc in DIR [/usr/include]   --infodir=DIR           info documentation in DIR [PREFIX/info]   --mandir=DIR            man documentation in DIR [PREFIX/man]   --srcdir=DIR            find the sources in DIR [configure dir or ..]   --program-prefix=PREFIX prepend PREFIX to installed program names   --program-suffix=SUFFIX append SUFFIX to installed program names   --program-transform-name=PROGRAM                           run sed PROGRAM on installed program names Host type:   --build=BUILD           configure for building on BUILD [BUILD=HOST]   --host=HOST             configure for HOST [guessed]   --target=TARGET         configure for TARGET [TARGET=HOST] Features and packages:   --disable-FEATURE       do not include FEATURE (same as --enable-FEATURE=no)   --enable-FEATURE[=ARG]  include FEATURE [ARG=yes]   --with-PACKAGE[=ARG]    use PACKAGE [ARG=yes]   --without-PACKAGE       do not use PACKAGE (same as --with-PACKAGE=no)   --x-includes=DIR        X include files are in DIR   --x-libraries=DIR       X library files are in DIR --enable and --with options recognized:   --enable-man-symlinks   use symlinks for the manpages   --enable-man-compression=PROG                       compress the manpages with PROG   --enable-man-suffix=STRING                       use STRING as a suffix to manpage file names                       (default: tcl)   --enable-threads        build with threads   --enable-shared         build and link with shared libraries [--enable-shared]   --enable-64bit          enable 64bit support (where applicable)   --enable-64bit-vis      enable 64bit Sparc VIS support   --enable-corefoundation use CoreFoundation API [--enable-corefoundation]   --disable-load          disallow dynamic loading and load command   --enable-symbols        build with debugging symbols [--disable-symbols]   --enable-langinfo       use nl_langinfo if possible to determine                           encoding at startup, otherwise use old heuristic   --enable-dtrace         build with DTrace support [--disable-dtrace]   --enable-framework      package shared libraries in MacOSX frameworks [--disable-framework]:
設定安裝引數:
[[email protected] unix]$./configure --prefix=/home/zx/tcl
[[email protected] unix]$make
[[email protected] unix]$make install

拷貝標頭檔案以供安裝expect時使用:

[[email protected] unix]$cp tclUnixPort.h ../generic/

安裝expect:

[[email protected] unix]$ cd /home/zx/expect-5.43

通過該命令可以檢視安裝引數:

[[email protected] expect-5.43]$ ./configure --help
Usage: configure [options] [host]
Options: [defaults in brackets after descriptions]
Configuration:
  --cache-file=FILE       cache test results in FILE
  --help                  print this message
  --no-create             do not create output files
  --quiet, --silent       do not print `checking...' messages
  --version               print the version of autoconf that created configure
Directory and file names:
  --prefix=PREFIX         install architecture-independent files in PREFIX
                          [/usr/local]
  --exec-prefix=EPREFIX   install architecture-dependent files in EPREFIX
                          [same as prefix]
  --bindir=DIR            user executables in DIR [EPREFIX/bin]
  --sbindir=DIR           system admin executables in DIR [EPREFIX/sbin]
  --libexecdir=DIR        program executables in DIR [EPREFIX/libexec]
  --datadir=DIR           read-only architecture-independent data in DIR
                          [PREFIX/share]
  --sysconfdir=DIR        read-only single-machine data in DIR [PREFIX/etc]
  --sharedstatedir=DIR    modifiable architecture-independent data in DIR
                          [PREFIX/com]
  --localstatedir=DIR     modifiable single-machine data in DIR [PREFIX/var]
  --libdir=DIR            object code libraries in DIR [EPREFIX/lib]
  --includedir=DIR        C header files in DIR [PREFIX/include]
  --oldincludedir=DIR     C header files for non-gcc in DIR [/usr/include]
  --infodir=DIR           info documentation in DIR [PREFIX/info]
  --mandir=DIR            man documentation in DIR [PREFIX/man]
  --srcdir=DIR            find the sources in DIR [configure dir or ..]
  --program-prefix=PREFIX prepend PREFIX to installed program names
  --program-suffix=SUFFIX append SUFFIX to installed program names
  --program-transform-name=PROGRAM
                          run sed PROGRAM on installed program names
Host type:
  --build=BUILD           configure for building on BUILD [BUILD=HOST]
  --host=HOST             configure for HOST [guessed]
  --target=TARGET         configure for TARGET [TARGET=HOST]
Features and packages:
  --disable-FEATURE       do not include FEATURE (same as --enable-FEATURE=no)
  --enable-FEATURE[=ARG]  include FEATURE [ARG=yes]
  --with-PACKAGE[=ARG]    use PACKAGE [ARG=yes]
  --without-PACKAGE       do not use PACKAGE (same as --with-PACKAGE=no)
  --x-includes=DIR        X include files are in DIR
  --x-libraries=DIR       X library files are in DIR
--enable and --with options recognized:
  --enable-threads        build with threads (not supported)
  --with-tcl           directory containing tcl configuration (tclConfig.sh)
  --with-tk           directory containing tk configuration (tkConfig.sh)
  --enable-symbols   allow use of symbols if available
  --with-tclinclude       directory where tcl private headers are
  --enable-shared     build libexpect as a shared library
  --with-x               whether or not to use X (default yes)
  --with-tkinclude       directory where tk private headers are
  --disable-load     disallow dynamic loading
  --enable-gcc        allow use of gcc if available

設定安裝引數:

[[email protected] expect-5.43]$./configure --prefix=/home/zx/expect 
    -with-tcl=/home/zx/tcl/lib -with-x=no 
    -with-tclinclude=/home/zx/tcl8.4.16/generic
[[email protected] expect-5.43]$make
[[email protected] expect-5.43]$make install

相關推薦

linux expect簡介安裝

簡介:                我們通過Shell可以實現簡單的控制流功能,如:迴圈、判斷等。但是對於需要互動的場合則必須通過人工來干預,有時候我們可能會需要實現和互動程式如telnet伺服器等進行互動的功能。而Expect就是用來實現這種功能的工具。   Expe

linux簡介安裝centos-64位具體步驟

1.linux的簡介        Linux是基於Unix的開源免費的作業系統,由於系統的穩定性和安全性幾乎成為程式程式碼執行的最佳系統環境,linux系統的應用非常廣泛,不僅可以長時間的執行我們編寫的程式程式碼,還可以安裝在各種計算機硬體裝置中,比如手

linux簡介安裝

linux1.簡介 誕生於1991年10月5日 linux是類Unix操作系統,基於POSIX和UNIX的多用戶、多任務、支持多線程和多CPU的操作系統。 支持32位和64位硬件,繼承了Unix以網絡為核心的設計思想。 創始人:林納斯·托瓦茲(Linus Benedict Torvalds) 特點:

效能測試監控平臺:InfluxDB+Grafana+Jmeter linux環境執行jmeter並生成報告 時序資料庫InfluxDB:簡介安裝 視覺化工具Grafana:簡介安裝

前面的部落格介紹了InfluxDB、Telegraf、Grafana的安裝和使用方法,這篇部落格,介紹下如何利用這些開源工具搭建效能測試監控平臺。。。   前言 效能測試工具jmeter自帶的監視器對效能測試結果的實時展示,在Windows系統下的GUI模式執行,渲染和效果不是太好,在linu

linux中資料倉庫工具hive簡介安裝部署詳解

簡介: Apache Hive是一個建立在Hadoop架構之上的資料倉庫。它能夠提供資料的精煉,查詢和分析。 hive是基於Hadoop的一個數據倉庫工具,可以將結構化的資料檔案對映為一張資料庫表,並提

maven 之maven簡介安裝

分享 運行 項目信息 ava 信息 專家 not 編碼 bin 1. maven:行內,專家。基於java的項目構建功能,依賴管理,項目信息管理,Maven是一個項目構建工具。 2.構建:指日常開發中經常完成的除了編碼外的一些動作。如:清理,編譯,測試,運行,報告,部署等動

Linux目錄簡介哲學思想

第三方軟件 文件夾 配置文件 操作系統 二進制 /頂級目錄自引導/root 超級用戶家目錄/sys存放系統硬件信息/opt 第三方軟件安裝目錄/proc 存放進程的文件目錄,是虛擬文件夾不在硬盤中存放/sbin 二進制文件目錄/usr 存放二進制程序和一些系統相關的文件/home

【轉】Nodejs學習筆記(一)--- 簡介安裝Node.js開發環境

ack 目錄 javascrip 難度 時間 網站開發 clas jetbrains 常用 目錄 學習資料 簡介 安裝Node.js npm簡介 開發工具 Sublime Node.js開發環境配置 擴展:安裝多版本管理器 學習資料   1.深入淺出Node.j

linux--系統啟動安裝過程詳解

linux啟動先通過一張圖來簡單了解下整個系統啟動的流程,整個過程基本可以分為POST-->BIOS-->MBR(GRUB)-->Kernel-->Init-->Runlevel本文出自 “運維自動化” 博客,請務必保留此出處http://shower.blog.51cto.co

Libcap的簡介安裝

pca apt-get 以太網 當前 upd 監控 提示 文件 wall Libpcap 簡介 libpcap 是unix/linux 平臺下的網絡數據包捕獲函數包,   大多數網絡監控軟件都以它為基礎。   Libpcap 可以在絕大多數類unix 平臺下工作.   Li

國際版Azure搭建Windows多種類型VPN_一.簡介安裝服務

azure vpn 很多時候我們需要一個穩定安全而且多種類型的VPN,以下是本次實驗的拓撲圖,實現SSTP和L2TP VPN。SSTP需要證書SSL來實現,而L2TP則是通過密鑰共享來實現(此連接方法適合與移動設備,不過安全性不夠SSTP好)。一.Azure 創建虛擬機登錄國際版Azure:htt

linux卸載安裝mysql 5.7以上

刪除mysql groupadd 根據 chown def -i sha 初始 ons 刪除: 1.rpm -qa|grep -i mysql 查看安裝的mysql 2./usr/local/mysql/support-files/mysql.server stop

大數據筆記(二十七)——Spark Core簡介安裝配置

sin cli sca follow com clu 同時 graphx 信息 1、Spark Core: 類似MapReduce 核心:RDD 2、Spark SQL: 類似Hive,支持SQL 3、Spark Streaming:類似

Linux系統簡介安裝RHEL7系統、RHEL7基本操作、總結和答疑

換工作 使用 pin scsi tel 安裝 localhost onf rhel7 在win2008命令行界面輸入:ipconfig 查看網絡參數 ############################################################

Sqoop簡介安裝部署

cdh5 ive not 簡介 ins one generate and lin 簡介: Apache Sqoop是專為Apache Hadoop和結構化數據存儲如關系數據庫之間的數據轉換工具的有效工具。你可以使用Sqoop從外部結構化數據存儲的數據導入到Hadoop分布

Apache Flume簡介安裝部署

display 根據 buffers type hello headers agent tran 結構圖 概述 Flume 是 Cloudera 提供的一個高可用的,高可靠的,分布式的海量日誌采集、聚合和傳輸的軟件。 Flume 的核心是把數據從數據源(source)收集

python簡介安裝

結構 特色 ofo $path .py 訪問 查看 二進制 程序開發 Python 是一個高層次的結合了解釋性、編譯性、互動性和面向對象的腳本語言。Python 的設計具有很強的可讀性,相比其他語言經常使用英文關鍵字,其他語言的一些標點符號,它具有比其他語言更有特色語法結構

zookeeper簡介安裝

get image html 官網 進一步 ima enc 成員 nco 1. Zookeeper簡介 1.1 概念zookeeper是一個維護配置信息、命名、提供分布式同步的集中式服務(也就是說主要用於分布式應用程序中)。它是一個分布式的協調服務。集群中節點個數最少是

nginx高性能WEB服務器系列之一簡介安裝

簡單的 使用 line 都是 hash 設置 figure request cor 註:原創作品,允許轉載,轉載時請務必以超鏈接形式標明文章 原始出處 、作者信息和本聲明。否則將追究法律責任。 nginx的強大之處不必要我細說,當初第一次接觸nginx的時候就發現了它的強

資料實時監控平臺(二):Telegraf簡介安裝

接著上一篇部落格:InfluxDB簡介及安裝,這篇部落格介紹下Linux環境下Telegraf安裝以及其功能特點。。。 官網地址:influxdata 官方文件:telegraf文件   環境:CentOS7.4 64位 Telegraf版本:0.11.1-1   一、Tel