大家讲道理2017-04-17 15:57:00
-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.
這個參數會影響,-regex [pattern]的匹配行為,類似使用不同的方言來解析正規表示式。
經過我的實驗,我覺得這麼寫
find . -regextype posix-extended -regex './autojump.(bash|zsh|sh)'
或者
find . -regextype posix-extended -regex './autojump.(ba|z)?sh'
./auto...
的./
是不能省略的,find
的正規匹配不能夠只匹配部分,要匹配完全(理解)。
==update==
如果前面的路徑很長,可以這樣子匹配
find . -regextype posix-extended -regex '.*autojump.(ba|z)?sh'