我想在命令替换中使用 find ,其中返回的文件名包含空格。我需要什么选项才能正确引用文件名?我试过-print0
了,但它在 shell 本身中不起作用。
例子:
command $(find . -type f) some other params
我也尝试过-exec echo "{}" \;
,但这也无济于事。
如果我set -x
用来显示 shell 扩展和执行的实际命令,我会得到:
$ command `find -type f -printf \"%p\"\ ` some other params
++ find -type f -printf '"%p" '
+ command '"./file_with' 'blanks"' '"./another' 'file"' some other params
单引号从何而来,为什么要应用于每个“单词”?