【发布时间】:2014-11-13 13:08:59
【问题描述】:
我要发送命令
exp_send -i $sid -- "yes\r"
到一个将执行命令并检查错误的函数。 应该是:
catch {exp_send -i $sid -- "yes\r"}
在哪里:
[catch {$cmd [join $args]}
这段代码有什么问题:
package require Expect
proc ErrorDetector {cmd args} {
global res
if { [catch {$cmd [join $args]} results] } {
puts "Connection Could not open for exp_send\n $results"
return -level 0 0
}
puts sion.
}
global spawn_id
set sid [spawn cmd.exe]
exp_send {ssh root@10.64.88.240}
ErrorDetector exp_send -i $sid -- "yes\r"
命令:
$cmd [join $args]
没有运行为:
$cmd [join $args]
【问题讨论】: