我之前问过类似的问题,但不幸的是,这里发布的解决scheme在这里不起作用。
我想exit 404
脚本,如果在我的cisco router
上通过tftp复制文件时发生错误,但不知道如何捕获错误:
例如:
cisco#copy tftp://10.78.9.3/startup-config.config startup-config Destination filename [startup-config]? Accessing tftp://10.78.9.3/startup-config.config... %Error opening tftp://10.78.9.3/startup-config.config (No such file or directory) cisco#
我试过的东西:
expect "%Error"
expect -re
) ^
, \$
, *
(Mabye错误消息之后有东西) expect -exact {%Error opening tftp://10.78.9.3/startup-config.config (No such file or directory}
为什么不expect
认识到这个错误信息? 是因为输出来自STDERR还是%
?