【发布时间】:2011-09-29 22:54:57
【问题描述】:
以下是tcl代码
#!/bin/sh
# \
exec tclsh "$0" ${1+"$@"}
package require Expect
package require log
source [file join [info library] init.tcl]
set exp::winnt_debug 1
log::lvChannel debug stdout
log::log debug "debug msg ON\r"
set env(TERM) dumb
array set OPTS {
host ""
user ""
passwd ""
login telnet
prompt "(%|#|>|\\$) $"
ls "/bin/ls -A1"
}
set xlpad "yahoo.com"
exec [auto_execok dir]
while {1} {
spawn ping $xlpad
set loss 0
set replya 0
for { set pingc 0 } { $pingc < 3 } { incr pingc 1} {
expect {
"timed out" {
incr loss 1
puts "intercepted time out message: $loss\n"
}
"Reply" {
incr replya 1
}
}
if { $replya > 2 } {
break
}
}
break
}
return
我收到以下消息:
无法执行“C:\Windows\System32\cmd.exe \c dir”:没有这样的文件或目录 在执行时 “执行 [auto_execok 目录]” (文件“mytst.tcl”第 35 行)但是 ping 工作正常。
【问题讨论】:
-
那必须是/c。正斜杠,而不是反斜杠。祝你好运找到那个错误。好在它是开源的。