shell中嵌套执行expect命令实例 shell中嵌套执⾏expect命令实例 ⼀直都想把expect的操作写到bash脚本⾥,这样就不⽤我再写两个脚本来执⾏了,搞了⼀下午终于有点⼩成就,给⼤家看看吧.系统:centos 5.x 1.先安装expect 复制代码代码如下:yum -y install expect 2.脚本内容:复制代码代码如下:cat auto_...
1.先安装expect 复制代码代码如下: yum -y install expect 2.脚本内容: 复制代码代码如下: cat auto_svn.sh #!/bin/bash passwd='123456' /usr/bin/expect <<-EOF set time 30 spawn ssh -p18330 root@192.168.10.22 expect { "*yes/no" { send "yes\r"; exp_continue } "*password:" { send ...
send "quit\r" interact expect eof EOF
1.先安装expect 代码如下: yum -y install expect 2.脚本内容: 代码如下: cat auto_svn.sh #!/bin/bash passwd='123456' /usr/bin/expect <<-EOF set time 30 spawn ssh -p18330 root@192.168.10.22 expect { "*yes/no" { send "yes\r"; exp_continue } "*password:" { send "$passwd\r" }...