windows10笔记本上,使用expect version 5.21的windows版本,在cmd终端下执行expect命令,如下:
D:\xxx>expect -d 111.txt,其中111.txt文件如下:
set timeout -1
spawn telnet 192.168.3.15
expect "Username"
send "aaa\r"
expect "password"
send "aaa"
expect eof
问题是spawn telnet没有任何回显信息,所以无论怎么匹配都是失败的
D:\xxx>expect -d 111.txt
expect version 5.21
argv[0] = expect argv[1] = -d argv[2] = 111.txt
set argc 0
set argv0 "111.txt"
set argv ""
executing commands from command file 111.txt
spawn telnet 192.168.3.15
parent: waiting for sync bytes
parent: now unsynchronized from child
spawn: returns {16896}
expect: does "" (spawn_id exp_spawn0) match glob pattern "Username"? no
几番调试都不成功,搜索不见相关描述,请大神指点一下
PS:在telnet下设置set localecho后还是不成功