#!/usr/bin/expect
if { $argc != 3 } {
        send_user "Usage: \[ipAddress\],Port:\[mml_port\] cmd:\[ cmd_info\]\n"
        exit
}

#ѲmmlĹýű
set timeout 20

set ip [lindex $argv 0]
set Port [lindex $argv 1]
set cmdinfo [lindex $argv 2]

spawn /opt/huawei/snas/sbin/mml $ip $Port

expect "*mml>>>*"
send "$cmdinfo\r"

expect "*mml>>>*"
sleep 2
send "q\r"

expect eof
exit 0 