小编xoi*_*oid的帖子

在变量中查找带有参数的命令

> find /etc -name 'shells'
/etc/shells     # good !!

> SEARCH="-name 'shells'"; find /etc $SEARCH
# nothing found - bad !!
Run Code Online (Sandbox Code Playgroud)

为什么“find”命令不能接受变量中的参数?

其他命令在这种模式下工作正常。它可能与空格和解析有关。我如何首先在变量中构造参数,然后使用此参数执行“查找”?

要清楚,我想制作 -name xxxx -o -name yyyyy -o -name zzzzz 的链,然后通过一次运行找到所有文件

bash find

4
推荐指数
1
解决办法
4641
查看次数

标签 统计

bash ×1

find ×1