Linux find 命令有问题吗? [英] Linux find command gotcha?
本文介绍了Linux find 命令有问题吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
您好,我正在尝试查找所有 js &一个 find 命令中的 css 文件.我尝试了以下所有方法但徒劳无功:
Hi I am trying to find all js & css files in one find command. I tried all of the below but in vain:
find WebContent -name "*.[jc]ss?"
find WebContent -name "*.[jc]ss{0,1}"
find WebContent -name "*.[jc][s]{1,2}$"
find WebContent -name "*.[jc]s{1,2}"
find WebContent -name "*.[jc]s[s]?"
现在呢??
推荐答案
-name
接受 globs,而不是正则表达式.如果您想使用正则表达式,可以使用 -regex
,但 -o
选项(意思是或")可能是最简单的解决方案:
-name
accepts arguments that are globs, not regular expressions. You could use -regex
if you wanted to use regular expressions, but the -o
option (meaning "or") is probably the simplest solution:
find WebContent -name "*.js" -o -name "*.css"
这篇关于Linux find 命令有问题吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文