码迷,mamicode.com
首页 >  
搜索关键字:expect tcl/tk    ( 1323个结果
expect实现自动化交互(转载)
综述:expect主要包含三部分,spawn,expect和sendspawn实现交互命令的劫持,是自动化交互的基础;然后可以用expect来进行结果查询;expect实现对交互命令输出的解析,得到关键字的查询,如password,user,然后停止,等待交互;send对解析字段内容尽心输入;如pa...
分类:其他好文   时间:2014-08-15 14:08:48    阅读次数:287
mysql输出信息保留++--边框方法
我这方法是通过expect实现的。安装expectyuminstall-yexpect操作:[root@ln-slave~]#cattest.sh/usr/local/mysql/bin/mysql-e"selectversion();"[root@ln-slave~]#lltest.sh-rwxr-xr-x1rootroot5008-1316:44test.sh[root@ln-slave~]#shtest.sh+------------+|version()|+------..
分类:数据库   时间:2014-08-13 19:14:08    阅读次数:424
expect与rsync 异步并行备份数据脚本
expect与rsync异步并行备份数据脚本 #!/bin/bash #author:qunying.liu #2014.08.02 #脚本用途:通过rsync从远程机器备份数据到本机机器对应目录 #脚本目录:/usr/local/scripts/,expect脚本目录:/usr/local/scripts/dsfilersync, #备注:一个机器对应一个exp脚本,该脚本中..
分类:其他好文   时间:2014-08-11 15:22:23    阅读次数:232
uva 11427 - Expect the Expected(概率)
题目链接:uva 11427 - Expect the Expected 题目大意:你每天晚上都会玩纸牌,每天固定最多玩n盘,每盘胜利的概率为p,你是一个固执的人,每天一定要保证胜局的比例大于p才会结束游戏,若n局后仍没有,就会不开心,然后以后再也不完牌,问说你最多会玩多少个晚上。 解题思路:当j/i ≤ p时有dp(i-1,j) (1-p) + dp(i-1, j-1) p,其他d...
分类:其他好文   时间:2014-08-11 00:21:01    阅读次数:208
批量登陆linux主机脚本
#test.sh #!/bin/bash dir=/home/test whilereadline do host=`echo$line|awk‘{print$1}‘` passwd=`echo$line|awk‘{print$2}‘` $dir/expect_ssh.sh$host$passwd& done<$dir/host.txt #expect_ssh.sh #!/usr/bin/envexpect setHOST[lindex$argv0] setPASSWD[lindex$argv..
分类:系统相关   时间:2014-08-05 11:33:10    阅读次数:243
linux备份和mysql登陆自动输入密码
1.mysql自动登陆,系统自己输入密码(1)安装亿需要的软件[root@db2~]#yuminstallexpect-*(2)在脚本中写入命令#!/usr/bin/expect-f--使用expect软件settimeout2--输出密码时延时2秒spawnmysql-uroot-p--mysql登陆命令expect"system"--mysql的密码send"system\n"--mysql的密码inte..
分类:数据库   时间:2014-08-05 03:15:19    阅读次数:265
ssh自动输入密码脚本 切换目录脚本
利用expect的,首先查看expect,命令:which expect#!/usr/bin/expect -fspawn ssh 用户名@ip地址expect "assword:"send "password\r"interact自动输入密码,切换目录#!/usr/bin/expect -fspa...
分类:其他好文   时间:2014-08-04 10:37:46    阅读次数:319
shell telnet 路由器
#!/usr/bin/expect -fspawn telnet 172.16.1.80expect "login" { send "admin\n" expect { "Password" { send "admin\n" } ...
分类:Web程序   时间:2014-08-02 20:51:24    阅读次数:269
expect登陆远程shell
Expect是一个用来实现自动交互功能的软件套件(Expect[isa]softwaresuiteforautomatinginteractivetools)。Expect语言是基于Tcl的,作为一种脚本语言,Tcl具有简单的语法:cmdargargarg一条Tcl命令由空格分割的单词组成。第一个单词是命令名称,其余的是命令参数。脚本代码如下:#..
分类:其他好文   时间:2014-08-01 20:10:53    阅读次数:272
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!