手机
当前位置:查字典教程网 >脚本专栏 >linuxshell >expect中为send语句上加变量的代码
expect中为send语句上加变量的代码
摘要:复制代码代码如下:#!/usr/bin/expectsetssh_user"fivetrees"setpassword"123456"spa...

复制代码 代码如下:

#!/usr/bin/expect

set ssh_user "fivetrees"

set password "123456"

spawn ssh -i /root/.ssh/$ssh_user root@xiaopp.3f.com

expect_before "no)?" {

send "yesr" }

sleep 1

expect "Enter passphrase for key*"

send "$passwordr"

for {set snum 0} {$snum <= 6} {incr snum} {

expect "*#"

send "ls -l /opt/backup/fivetreesdb_s$snumr"

sleep 3

}

sleep 2

expect "*#"

send "echor"

exit

【expect中为send语句上加变量的代码】相关文章:

Shell编程中的特殊变量之位置变量介绍

rhel5.7下安装gearmand及启动的方法

Shell脚本中判断变量为数字的3种方法

shell中1小于/dev/null 2大于&1的含义

Linux下Oracle归档日志自动清理脚本代码(sh)

分享awk变量$0的妙用

Linux中搭建FTP服务器的方法

Shell脚本实现复制文件到多台服务器的代码分享

Shell脚本中执行sql语句操作mysql的5种方法

一个简单的转换输出的shell脚本代码

精品推荐
分类导航