为什么我用expect登陆到另一台机器上,不能执行任何命令?

发表于:2007-06-08来源:作者:点击数: 标签:

我已安装了TCL和EXPECT软件,expect在/usr/local/bin下,我写的sh程序不能运行,程序如下,文件名为:1.sh,请教:
#!/usr/local/bin/expect -f
spawn te.net 111.1.10.112
expect "login:"
send "root\r"
expect "password:"
send "111111\r"
send "ls -l\n"
#./expect  1.sh
程序运行到password处,就跳了出来,请教!!!!!

 wwwzc 回复于:2004-11-16 17:39:05
#!/usr/local/bin/expect -f 
spawn telnet 111.1.10.112 
expect "login:" 
send "root\r" 
expect "password:" 
send "111111\r" 
interact

原文转自:http://www.ltesting.net