#!/usr/bin/expect
log_user 0             //0不顯示輸出
spawn telnet 10.0.8.250
expect " Login Menu"
sleep 1
expect " Login: "
send "your account\r"
expect " Password: "
send "your passwd\r"
expect "Command>"
send "a\r"
expect "Command>"
send "p\r"
expect "Command>"
send "p\r"
send_user "Complete!!"   //送訊息給user
interact

 如果要丟變數進expect,可以用 [lindex $argv 0]
相當於shell script中的$1
例如:
 send "int gi [lindex $argv 0]\n"

arrow
arrow
    全站熱搜
    創作者介紹
    創作者 slinbody 的頭像
    slinbody

    495884965

    slinbody 發表在 痞客邦 留言(0) 人氣()