运行expect时标准输出没有结果
每当我尝试运行该脚本时,它都不会在标准输出上显示任何结果。
#!/usr/bin/expect --
send [exec tail -f /var/opt/jboss/log/jbossall.log | grep -i "pattern"]
请告知原因。
Whenever I try to run the script it doesn't show me any result on standard output.
#!/usr/bin/expect --
send [exec tail -f /var/opt/jboss/log/jbossall.log | grep -i "pattern"]
Please advise the reason.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
exec
命令永远不会完成,因为您使用的是tail -f
。从 tail 的信息页面:“永远循环尝试在文件末尾读取更多字符”。由于exec
未完成,因此永远不会调用send
。你可能需要做这样的事情:
The
exec
command never completes because you're usingtail -f
. From the info page for tail: "Loop forever trying to read more characters at the end of the file". Sinceexec
does not complete,send
is never invoked.You probably need to do something like this: