手机
当前位置:查字典教程网 >脚本专栏 >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脚本运行5秒后自动退出的代码

Linux中搭建FTP服务器的方法

ping发现掉包报警的shell代码

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

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

C语言实现的ls命令源码分享

Shell中的变量使用小结

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

linux中mysql备份shell脚本代码

分享awk变量$0的妙用

精品推荐
分类导航