Linux expect 案例

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Linux expect 案例相关的知识,希望对你有一定的参考价值。

#!/usr/bin/expect

set host "192.168.31.100"
set password "lishiming"

spawn ssh [email protected]$host
expect {
"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 案例的主要内容,如果未能解决你的问题,请参考以下文章

报错:✘ http://eslint.org/docs/rules/indent Expected indentation of 0 s paces but found 2(代码片段

expect免交互脚本编程

Shll编程之Expect免交互

Shell编程之Expect免交互

shell脚本引用expect

Expect入门