或许最好用一个例子来解释。我想这样做:
文件:
one
two
three
命令:
cat file | xargs -n1 show_square_of_stringed_number
输出:
one one
two four
three nine
show_square_of_stringed_number two
只返回four
,只能接受一个参数。
不寻找show_square_of_stringed_number
的实现,而是简单地如何在输出旁边回送管道(两个)的输入(四个)。
希望xargs
内置此功能。无法使用tee <(show_square)
,因为它在整个列表上运行,而不是在单行上运行。