我想知道如何使用TCL获取上一条命令的输出。
我现在的结构如下:
exp_send -i $spawn_id "show port-access supplicant\r"
set buff ""
expect -regexp {".*"}
expect -regexp ".*#" {send "show port-access supplicant\r"}
expect eof*此时的命令返回正确的信息,但我不知道如何将其存储到变量中。
我在读关于expect_out的文章,但是我不能让它工作!
发布于 2011-10-22 11:21:14
您可以使用expect buffer来完成此操作。完成您的2个匹配:
expect -regexp ".#" {send "show port-access supplicant\r"}
expect -regexp ".#"; #Match the prompt again after the device output returns然后尝试:
puts $expect_out(buffer)https://stackoverflow.com/questions/7856912
复制相似问题