shell 执行expect
2015-10-30 11:29
190 查看
<pre name="code" class="sql">#!/bin/bash passwd='1234567' /usr/bin/expect<<EOF set time 30 spawn scp 1.sh root@192.168.32.65:/root expect { "*yes/no" { send "yes\r"; exp_continue } "*password:" { send "$passwd\r" } } expect eof EOF /usr/bin/expect<<EOF spawn ssh root@192.168.32.65 expect { "*yes/no" { send "yes\r"; exp_continue } "*password:" { send "$passwd\r" } } expect "*#" send "who\r" expect "*#" send "date\r" expect "*#" send "exit\r" interact expect eof EOF
相关文章推荐
- shell技巧
- shell技巧
- shell 脚本完成对日志文件的提取
- shell命令getopts
- shell命令getopts
- 如何使用PowerShell操作MySQL
- Linux-shell学习笔记
- 使用git bash 代替cmd
- Bash Shell编程要点小结
- 什么是shell,shell基础由浅入深,常用的shell命令、用法、技巧
- ubuntu操作系统写shell的for循环会遇到的问题
- sqlite3 shell的使用
- sqlite3 shell的使用
- shell脚本实例参考
- shell script 学习笔记-----标准输出
- Shell脚本之监视主进程的运行状态,异常退出后自动重启
- shell脚本:打印文本中字符数不大于6的单词
- shell脚本:打印文本中字符数不大于6的单词
- 《Linux Shell》笔记之sed与正则表达式(实例总结) 未完待续
- 一定要记住的一些shell命令