我正在运行 Tcl 脚本来连接 Telnet 端口。对于这个脚本,我想将所有 CMD 输出存储在一个日志文件中。如何在 Tcl 脚本中执行此操作?脚本如下:
#!/usr/bin/expect -f
#!usr/bin/expect
package require Expect
spawn telnet $serverName $portNum
expect "TradeAggregator>"
send "Clients\r"
expect "Client:"
send "1\r"
expect "1-Client>"
send "Pollers\r"
expect "Client Pollers"
send "2\r"
send "n\r"
expect ">"
set passwordOption $expect_out(buffer)
set searchString "Not confirmed"
if {[string match *$searchString* $passwordOption]} {
puts "match found" }\
else {
puts "match not found"
xmlPasswordChange $polName
}
所有 puts 输出和 xmlPasswordChange 过程输出都没有打印在日志文件中。你能指出我做错了什么吗?
提前感谢您的帮助。