手机
当前位置:查字典教程网 >脚本专栏 >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种方法

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

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

except自动登录的几段代码分享

Linux中搭建FTP服务器的方法

分享awk变量$0的妙用

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

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

比较两个字符串是否相等的shell代码

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

精品推荐
分类导航