gpt4 book ai didi

bash - osx 查找 exec rm 查找 : exec: unknown primary or operator

转载 作者:行者123 更新时间:2023-11-29 08:44:03 25 4
gpt4 key购买 nike

我有一堆以“-e”结尾的文件要删除。

$ find . -name "*-e" exec rm {} \;
find: exec: unknown primary or operator

正则表达式是否以某种方式扩展导致一切困惑?

最佳答案

应该是:

find . -name "*-e" -exec rm '{}' \;

或者更好:

find . -name "*-e" -exec rm '{}' +

根据 man find:

-exec utility [argument ...] {} +
Same as -exec, except that ``{}'' is replaced with as many pathnames as possible for
each invocation of utility. This behaviour is similar to that of xargs(1).

关于bash - osx 查找 exec rm 查找 : exec: unknown primary or operator,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27915657/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com