我经常通过管道将程序输出减少到更少,例如
produce_output | less
Run Code Online (Sandbox Code Playgroud)
这很好用,直到produce_output
产生大量输出。如果我搜索文件深处的某些文本,则报告较少
Calculating line numbers... (interrupt to abort)
Run Code Online (Sandbox Code Playgroud)
如果我用 Control+C 中断,它也会杀死produce_output
,这会阻止它产生进一步的输出。有没有办法将中断发送到less,以便produce_output
继续运行?
我知道我可以使用kill -INT less_process
,但我认为必须有更好的解决方案。