您现在的位置是:网站首页> 编程资料编程资料
expect中为send语句上加变量的代码_linux shell_
2023-05-26
384人已围观
简介 expect中为send语句上加变量的代码_linux shell_
复制代码 代码如下:
#!/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 "yes\r" }
sleep 1
expect "Enter passphrase for key*"
send "$password\r"
for {set snum 0} {$snum <= 6} {incr snum} {
expect "*#"
send "ls -l /opt/backup/fivetreesdb_s$snum\r"
sleep 3
}
sleep 2
expect "*#"
send "echo\r"
exit
相关内容
- shell脚本运行5秒后自动退出的代码_linux shell_
- 比较两个字符串是否相等的shell代码_linux shell_
- 五个常用的Linux监控脚本代码_linux shell_
- shell实现数字打印从100到200的数_linux shell_
- 统计 cpu 内存 使用率的shell脚本代码_linux shell_
- 一个用了统计CPU 内存 硬盘 使用率的shell脚本_linux shell_
- shell 进度条实现代码_linux shell_
- awk统计文件中某关键词出现次数的命令_linux shell_
- shell查找当前目录下大于1M的文件的三种方法分享_linux shell_
- expect自动检测并重启另外一台服务器上的程序代码_linux shell_
