全部博文(343)
分类: LINUX
2008-05-29 10:15:03
#!/usr/bin/expect ############################################## # #sf.exp: an expect script used to execute a # command on remote handset. # #Usage: se.exp [ipaddr] [command] ############################################## set timeout 100000 set TERM xterm set ipaddr [lindex $argv 0] set command [lindex $argv 1]
spawn telnet $ipaddr expect "(none) login:" send "root\r"
expect "#" send "$command\r"
expect "#" send "exit\r" |