expect 的安装
来源:互联网 发布:sql id=@id 编辑:程序博客网 时间:2024/05/18 11:48
安装tcl和expect
#tar zxvf tcl8.4.11-src.tar.gz #cd tcl8.4.11/unix #./configure && make && make install #cp tclUnixPort.h ../generic/
#tar zxvf expect-5.43.0.tar.gz #cd expect-5.43/ #./configure --with-tcl=/usr/local/lib/ --with-tclinclude=/ /home/nagios/tcl8.4.11/generic/ --with-x=no
#make && make install
OK,tcl以及expect已经安装完成了.下面给出scp的一个expect很简单的一个脚本
#!/usr/local/bin/expect
spawn scp /home/nagios/tuning-primer.sh nagios@192.168.100.104:/home/nagios/
expect "Password:"
exec sleep 2
send "nagios&*(/n"
interact
二、Windows下except的安装和使用
这是一个自动登录AIX服务器的例子。
1、先去如下地方下载expect:
windows">http://expect.nist.gov/#windows
ftp://bmrc.berkeley.edu/pub/winnt/tcltk/expect
2、安装默认路径是C:Program FilesExpect-5.21bin
expect.exe就在这里
3、写个简单的脚本sample.txt
spawn telnet aixserver
expect "login:"
send "mynamer"
expect "Password:"
send "mypassr"
send "lsr"
send "prtconfr"
expect eof
PS:网页的问题,脚本中的“\”等符号会丢失。
4、运行命令expect sample.txt看看效果
5、看看expect的一些帮助信息:
「开始」菜单程序Expect-5.21Tcl 8.0 Shell with Expect
敲?和help看看
原文地址 http://linux.chinaitlab.com/set/796884.html
- expect的安装使用
- expect 的安装
- LINUX EXPECT的安装
- expect的安装
- expect的安装
- expect的源码安装方法
- 安装expect
- expect安装
- 安装expect
- expect 安装
- expect 安装
- expect安装
- expect安装
- 安装expect
- expect安装
- expect安装
- expect 安装
- linux下expect的安装方法
- 汇编除法优化~
- poj 2187 Beauty Contest(旋转卡壳求最远点对)
- 采用Apache Wicket搭建web应用开发平台
- java反射的学习
- 内联汇编
- expect 的安装
- 数据结构的作业
- C# 文件写入
- 最近
- 汇编大小写转换的一个技巧~~
- Struts2中Action访问Servlet API的三种方法
- bash、dash(/bin/bash和/bin/sh)
- C++ Smart Pointers 和“与继承有关的”类型转换
- 用nagios来监控网络服务器和网络服务