手机
当前位置:查字典教程网 >脚本专栏 >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脚本中执行sql语句操作mysql的5种方法

ssh expect自动登录的脚本代码

shell脚本中case条件控制语句的一个bug分析

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

nagios 分发文件实现代码

ping发现掉包报警的shell代码

防止shell脚本重复执行的代码

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

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

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

精品推荐
分类导航