在rsync
我可以在一个数组中定义我的排除/选项并在后续命令中使用这些数组,例如
rsync "${rsyncOptions[@]}" "${rsyncExclusions[@]}" src dest
我想使用该find
命令实现相同的目的,但找不到使其工作的方法:
findExclusions=(
"-not \( -name '#recycle' -prune \)"
"-not \( -name '#snapshot' -prune \)"
"-not \( -name '@eaDir' -prune \)"
"-not \( -name '.TemporaryItems' -prune \)"
)
LC_ALL=C /bin/find src -mindepth 1 "${findExclusions[@]}" -print
在我尝试定义数组的任何组合中(单引号与双引号,转义括号)我总是以错误告终:
find: unknown predicate `-not \( -name '#recycle' -prune \)'
# or
find: paths must precede expression: ! \( -name '#recycle' -prune \)
这样做的正确方法是什么?