适配器模式 Adapter Pattern 变压器模式Convert the interface of a class into another interface clients expect.Adapter lets classes work together that couldn’t otherwise because of incompatible interfaces.将一个类的接口变换...
分类:
其他好文 时间:
2015-08-29 17:02:26
阅读次数:
169
小毛毛初拥expect前几天在写脚本的时候我有一个功能是想切换用户,让他自动输入密码。实现交互式的登陆。发现了expect这个工具。但是从来没有用过,所以也是出了很多问题。今天就来总结下!希望以后同样是新手的朋友不再走弯路。1.首先确认expect的包要安装成功我用的centos6...
分类:
其他好文 时间:
2015-08-28 02:27:09
阅读次数:
229
expect 的核心是 spawn expect send setspawn 调用要执行的命令expect 等待命令提示信息的出现,也就是捕捉用户输入的提示:send 发送需要交互的值,替代了用户手动输入内容set 设置变量值interact 执行完成后保持交互状态,把控制权交给控制台,这个时候就可...
分类:
其他好文 时间:
2015-08-27 13:00:22
阅读次数:
239
大家需要在每个节点上提前装好"expect"工具expect的使用请看我的另一篇文章:http://tianxingzhe.blog.51cto.com/3390077/1687661spawn命令激活一个Unix程序来进行交互式的运行。send命令向进程发送字符串。expect命令等待进程的某些字符串settimeout1设置超时时间timeout-1为..
分类:
其他好文 时间:
2015-08-25 12:35:58
阅读次数:
311
expect安装命令yum-yinstallexpect脚本代码如下:#!/usr/bin/expect
settimeout30
spawnssh-lusername192.168.1.1
expect"password:"
send--"ispass\r"//--可加也可不加
interact脚本文件执行需要使用shell命令:expectfilename来执行命令详细解释1.#!/usr/bin/expect这一..
分类:
系统相关 时间:
2015-08-25 12:29:23
阅读次数:
223
工具链为:
OpenWrt-Toolchain-x86-generic_gcc-4.8-linaro_glibc-2.21.Linux-i686.tar.bz2
错误提示如下:
i486-openwrt-linux-gnu-gcc.bin: warning: environment variable 'STAGING_DIR' not defined
i486-openwrt-linux...
分类:
其他好文 时间:
2015-08-20 20:54:38
阅读次数:
235
E -期望(经典问题)Time Limit:1000MSMemory Limit:32768KB64bit IO Format:%lld & %lluSubmitStatusDescriptionGiven a dice withnsides, you have to find the expect...
分类:
其他好文 时间:
2015-08-19 11:04:45
阅读次数:
211
E -期望(经典问题)Time Limit:1000MSMemory Limit:32768KB64bit IO Format:%lld & %lluSubmitStatusDescriptionGiven a dice withnsides, you have to find the expect...
分类:
其他好文 时间:
2015-08-18 21:00:42
阅读次数:
128
1、什么是expect在做系统管理时,我们很多时候需要输入密码,例如:连接 ssh,连接ftp,那么如何能做到不输入密码,我们需要有一个工具,能代替我们实现与终端的交互,它能够代替我们实现与终端的交互,我们不必再守候在电脑旁边输入密码,或是根据系统的输出再运行相应的命令,这些都可以由expect代替...
分类:
系统相关 时间:
2015-08-13 01:06:17
阅读次数:
155
示例: ? Example?1?-?uses?login?method,?longhand?scp:
????????my?$scpe?=?Net::SCP::Expect->new;
????????$scpe->login(‘user?name‘,?‘password‘);
????????$scpe->sc...
分类:
Web程序 时间:
2015-08-12 17:10:40
阅读次数:
163