Trailing arguments with find -exec {} +

我是研究僧i 提交于 2019-12-02 18:31:20

问题


I want to add a trailing argument to the appending version of the-exec option of find.

find . -exec echo {} asd +
# expecting the following output:
file1 file2 file3 [...] asd

Does not work as {} must be the last word before +. (Bonus question: Why was that trivial looking feature not implemented?)

What is the simplest expression to archive this, that can handle filenames with spaces and special characters? POSIX conformance would be a nice to have but it is sufficient if it works with Linux.


回答1:


find . -exec sh -c 'echo "$@" asd' _ {} +


来源:https://stackoverflow.com/questions/40429954/trailing-arguments-with-find-exec

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!