我需要在管道中使用多种工具处理图像tool1 | tool2 | tool3 | ...
。虽然其中一个工具似乎不是为在管道中工作而设计的,但只能以user@computer:/~# bad_tool infile.png outfile.png
.
有没有办法将它包含在管道中?我真的想避免为这个唯一的程序创建文件然后删除它们等。
如果管道通常是:
tool1 | tool2 | tool3
Run Code Online (Sandbox Code Playgroud)
但是 tool2 是“坏”的,它需要 2 个参数(第一个是输入文件,第二个是输出文件),您可以像这样重写它:
tool2 <(tool1) >(tool3)
Run Code Online (Sandbox Code Playgroud)
当然,如果您的 shell 支持进程替换。
归档时间: |
|
查看次数: |
146 次 |
最近记录: |