我想在一个目录下复制一批文件,其中一些文件的名称中有空格和单引号。 当我试图将find
和grep
与xargs
串起来时,我得到了以下错误:
find .|grep "FooBar"|xargs -I{} cp "{}" ~/foo/bar
xargs: unterminated quote
对于xargs更强大的用法有什么建议吗?
这是在Mac OS X 10.5.3(Leopard)上使用BSD xargs
。
查找.-print0 | grep --null 'FooBar' | xargs -0 ...
。
我不知道grep
是否支持--null
,也不知道xargs
是否支持-0
,在Leopard上,但在GNU上都很好。