我想将命令的每个输出作为多个参数传递给第二个命令,例如:
grep "pattern" input
Run Code Online (Sandbox Code Playgroud)
收益:
file1
file2
file3
Run Code Online (Sandbox Code Playgroud)
我想复制这些输出,例如:
cp file1 file1.bac
cp file2 file2.bac
cp file3 file3.bac
Run Code Online (Sandbox Code Playgroud)
我怎么能一气呵成呢?就像是:
grep "pattern" input | cp $1 $1.bac
Run Code Online (Sandbox Code Playgroud)