最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
centos6中shell嵌套expect执行命令
时间:2022-06-30 21:29:21 编辑:袖梨 来源:一聚教程网
系统:centos 6.x
1.先安装expect
| 代码如下 | 复制代码 |
|
yum -y install expect |
|
2.脚本内容:
| 代码如下 | 复制代码 |
|
cat auto_svn.sh |
|
这样写的话,就方便得很多,一个脚本就包括完了.
expect的简单用法及举例
使用脚本文件的例子--实现自动输密码
| 代码如下 | 复制代码 |
| #!/usr/bin/expect -f set password 123456 #download spawn scp [email protected]:/root/a.wmv /home/yangyz/ set timeout 300 expect "[email protected]'s password:" set timeout 300 send "$passwordr" set timeout 300 send "exitr" expect eof |
|