Ver Fonte

-i makes find case insensitive too

George Jones há 1 ano atrás
pai
commit
07386c0336
1 ficheiros alterados com 3 adições e 1 exclusões
  1. 3 1
      rc.local/latest.sh

+ 3 - 1
rc.local/latest.sh

@@ -60,6 +60,7 @@ function latest ()
     MTIME=${MTIME:-7}
     WHERE=${WHERE:-.}
     TIMEOUT=30 # max run at 30 seconds
+    FIND_REGEX="-regex" # case sensitive by default
     which timeout > /dev/null || die "Timeout not found"
 
     # define filenames/paths to be ignored
@@ -186,6 +187,7 @@ EOF2
             REGEX="${1}";  { { [[ $# -gt 0 ]] && shift; } || die '--grep requires an argument'; }  ;;
         -i|--ignore-case)
             shift;
+            FIND_REGEX="-iregex"
             GREPFLAGS+=("-i");;
         -l|--files-with-matches)
             shift;
@@ -268,7 +270,7 @@ EOF2
         -mtime -"${MTIME}"\
         \
         $(: COMMENT restrict to files that match "$WHAT" in full pat) \
-        -regex ".*${WHAT}.*" \
+        ${FIND_REGEX} ".*${WHAT}.*" \
         \
         $(: COMMENT run grep if requested: "${GREPFLAGS[*]}") \
         ${GREPFLAGS[*]} && \