首页 > 代码库 > Linux expect 案例

Linux expect 案例

#!/usr/bin/expectset host "192.168.31.100"set password "lishiming"spawn ssh root@$hostexpect {"yes/no" { send "yes\r"; exp_continue }"assword:" { send "$password\r" }}expect "]*"send "touch /tmp/1.txt\r"expect "]*"send "echo 1212 > /tmp/1.txt\r"expect "]*"send "exit\r"

 

 

 

 

    

 

   

Linux expect 案例