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

shell

时间:2019-01-01 23:55:13      阅读:256      评论:0      收藏:0      [点我收藏+]

标签:end   expect   出现   isp   view   命令   pen   cab   shell   

  expect自动交互编程

技术分享图片
#!/usr/bin/expect           #使用的解释器
set timeout 30                #设置超时时间为30秒
#spawn ssh 127.0.0.1    
spawn ssh-keygen            #spawn为格式,后面写shell命令
expect {
    ".ssh/id_rsa" { send "\r"; exp_continue } #有出现.ssh/id_rsa字符串的返回 回车键,并且继续
    "Enter passphrase" { send "\r"; exp_continue }#同上
    "passphrase again" { send "\r" }
}
interact      #结束后交给终端       
View Code

 

shell

标签:end   expect   出现   isp   view   命令   pen   cab   shell   

原文地址:https://www.cnblogs.com/fengzi7314/p/10206321.html

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