Linux找到命令gotcha? [英] Linux find command gotcha?

查看:149
本文介绍了Linux找到命令gotcha?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图找到所有的JS&在一个查找命令的css文件。我尝试了所有的下面,但徒劳无功:

  find WebContent -name*。[jc] ss? 

查找WebContent -name*。[jc] ss {0,1}

查找WebContent -name*。[jc] [s] {1,2 }

找到WebContent -name*。[jc] s {1,2}

找到WebContent -name*。[jc] s [s] ?

现在是什么?

解决方案

-name 接受 globs ,而不是正则表达式。如果你想使用正则表达式,你可以使用 -regex ,但是 -o 选项(意思是或)可能是最简单的解决方案:

pre $ 查找WebContent -name* .js-o -name * .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]?"

Now what??

解决方案

-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找到命令gotcha?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆