为什么文件存在时它什么都没有查找?
find ./ -regex '.*(jar|war)'
答案 0 :(得分:2)
有关正则表达式支持的语法的信息,请参阅 man find :
-regextype type
Changes the regular expression syntax understood by -regex and
-iregex tests which occur later on the command line. Currently-
implemented types are emacs (this is the default), posix-awk,
posix-basic, posix-egrep and posix-extended.
这有效:
$ find . -regextype egrep -regex '(.*jar)|(.*war)'
为避免使用 -regextype 将表达式更改为emacs正则表达式:
$ find . -regex '.*\(jar\|war\)'