码迷,mamicode.com
首页 > 系统相关 > 详细

Linux自动人机交互expect

时间:2018-03-01 10:16:06      阅读:174      评论:0      收藏:0      [点我收藏+]

标签:post   执行   pre   ash   linu   gpo   inux   body   expect   

exp_test.sh文件

#!/bin/bash/expect
## exp_test.sh
set timeout -1;
spawn ssh localhost;
expect{
    "(yes/no)" {send "yes\r";exp_continue;}
    "password:" {send "hadoop\r";exp_continue;}
    eof {exit 0;}
}

执行:expect exp_test.sh

Linux自动人机交互expect

标签:post   执行   pre   ash   linu   gpo   inux   body   expect   

原文地址:https://www.cnblogs.com/TheoryDance/p/8486973.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!