的参数Linux命令输出我想传递一个命令的元件的输出列表作为另一命令的参数。我已经发现了一些其他的网页:作为另一个命令
- How to display the output of a Linux command on stdout and also pipe it to another command?
- Use output of bash command (with pipe) as a parameter for another command
,但他们似乎更复杂。
我只是想将文件复制到到Linux find
命令拨打电话的每个结果。
这里有什么问题?:
find . -name myFile 2>&1 | cp /home/myuser/myFile $1
感谢
只需将{}的顺序更改为/ home/myuser/myFile之后的第二个位置,它就可以工作。谢谢。 –
@LuisAndrésGarcía啊,我可能误解了你 - 你想复制一个文件'/ home/myuser/myFile'来覆盖cwd中'find'找到的任何'myFile'? –
你是对的! :)另一个例子,列出任何找到的文件的属性是:find -exec ls -l {}';' –