How to realize automatic login of except
This article mainly shows you "how to achieve except automatic login", the content is easy to understand, clear, hope to help you solve your doubts, the following let the editor lead you to study and learn "how to achieve except automatic login" this article.
The code is as follows:
#! / usr/bin/expect-f
Set timeout 30
Set host "192.168.1.198"
Spawn ssh $host
Expect_before "no)? {
Send "yes\ r"}
Sleep 1
Expect "password:"
Send "123456\ r"
Expect "* #"
Send "echo my name is fivetrees > / root/fivetrees.txt\ r"
Interact
# #--
The code is as follows:
[root@fivetrees ~] # cat expect
#! / usr/bin/expect
For {set I 10} {$I