linux expect一个自动的脚步

#!/usr/bin/expect

spawn ssh [email protected]
set password [lrange $argv 0 0]

#expect "*password*"
#send "1/r"

#for {} 1 {} {
#    expect {
#     "*password*"        {send "asa$password/r"}    
#     "*Select server:*"    {send "1/r"}    
#     "*aliapp@oidh2*"    {send "sql/r"}
#     "@>"            {send "conn frnd/asasas@crmcn";send "/r";interact;}
#    }
#}


expect "*password*"
send "$password/r"

expect "*Select server:*"
send "1/r"

expect "*aliapp@oidh2*"
send "sql/r"

expect "@>"
send "conn frnd/abcd@crmcn/r"

interact;

你可能感兴趣的:(linux expect一个自动的脚步)