gpt4 book ai didi

bash - 如何使 Bash 命令超时并计算发送到标准输出的行数?

转载 作者:行者123 更新时间:2023-11-29 09:05:25 25 4
gpt4 key购买 nike

我想做一些像 timeout 12s tail -f access.log | 这样的事情wc -l 但我没有看到 wc 的输出。需要做什么才能做到这一点?

最佳答案

使用 --foreground 选项和 timeout:

timeout --foreground 12s tail -f access.log | wc -l

根据人工超时:

--foreground   when not running timeout directly from a shell prompt,
allow COMMAND to read from the TTY and get TTY signals;
in this mode, children of COMMAND will not be timed out

关于bash - 如何使 Bash 命令超时并计算发送到标准输出的行数?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43688626/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com