自动交互命令
yum -y install expect
#!/usr/bin/expect
执行
expect expect.sh
-P //端口
spawn 执行shell命令的
expect 匹配到
send 返回值
1.免密交互
#!/usr/bin/expect
set timeout 10 //如果10秒内没有任务执行就退出
spawn ssh root@10.0.0.43
expect "*password*"
send "123456\r"
interact
     
原文:https://www.cnblogs.com/gaiting/p/12175228.html