相关疑难解决方法(0)

GNU 为某些 shell 查找并屏蔽 {} - 哪个?

GNU find 的手册页指出:

-exec command ;
    [...] The  string `{}'  is  replaced  by the current 
    file name being processed everywhere it occurs in the 
    arguments to the command, not just in arguments where 
    it is alone, as in some  versions  of  find.
    Both  of  these  constructions might need to be escaped 
    (with a `\') or quoted to protect them from expansion 
    by the shell. 
Run Code Online (Sandbox Code Playgroud)

那是从人到find(GNU findutils)4.4.2。

现在我用 bash 和 dash 测试了这个,两者都不需要{}被屏蔽。这是一个简单的测试:

find /etc -name "hosts" -exec …
Run Code Online (Sandbox Code Playgroud)

shell find xargs quoting

37
推荐指数
3
解决办法
3846
查看次数

标签 统计

find ×1

quoting ×1

shell ×1

xargs ×1