手机
当前位置:查字典教程网 >脚本专栏 >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脚本中使用iconv实现批量文件转码的代码分享

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

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

linux中批量修改文件名的脚本代码

bash脚本中if语句的使用方法

Linux中搭建FTP服务器的方法

expect自动检测并重启另外一台服务器上的程序代码

用shell脚本和c语言将大写字母转成小写的代码

shell脚本从SVN推送到多台服务器的代码

shell脚本运行5秒后自动退出的代码

精品推荐
分类导航