随笔分类 - expect
摘要:使用expect在script中切换到root用户 1.尚观版本 http://www.uplook.cn/biancheng/133/1335040/ 1 a. 命令行: /usr/bin/expect -c "set timeout -1; spawn su; expect \"Password
阅读全文
摘要:linux expect详解 expect是一个自动化交互套件,主要应用于执行命令和程序时,系统以交互形式要求输入指定字符串,实现交互通信。 expect自动交互流程: spawn启动指定进程 expect获取指定关键字 send向指定程序发送指定字符 执行完成退出. expect常用命令总结: s
阅读全文
摘要:一.登陆到远程主机 脚本代码如下: ############################################## #!/usr/bin/expect set timeout 30 spawn ssh -l username hostip expect { "yes/no" { se
阅读全文
摘要:expect正则捕获返回结果expect: expect -re "([0-9]*)([a-zA-Z]*)"send_user "num is $expect_out(1,string), string is $expect_out(1,string)"这里[0-9]*表示一个或多个数字,[a-zA
阅读全文

浙公网安备 33010602011771号