smarter regex
authormkrzewic <mikolaj.krzewicki@cern.ch>
Mon, 8 Dec 2014 12:40:32 +0000 (13:40 +0100)
committermkrzewic <mikolaj.krzewicki@cern.ch>
Mon, 8 Dec 2014 13:05:21 +0000 (14:05 +0100)
PWGPP/scripts/utilities.sh

index 70c1508..edf41f6 100644 (file)
@@ -297,7 +297,7 @@ summarizeLogs()
   done
 
   local logFiles
-  logFiles=".*log|stdout|stderr"
+  logFiles="\.*log$|^stdout$|^stderr$"
 
   #check logs
   local logStatus=0
@@ -307,8 +307,8 @@ summarizeLogs()
   for file in "${files[@]}"; do
     [[ ! -f ${file} ]] && continue
     #keep track of core files for later processing
-    [[ "${file}" =~ core$ ]] && coreFiles[${file}]="${file}" && continue
-    [[ ! "${file}" =~ ${logFiles} ]] && continue
+    [[ "${file##*/}" =~ ^core$ ]] && coreFiles[${file}]="${file}" && continue
+    [[ ! "${file##*/}" =~ ${logFiles} ]] && continue
     errorSummary=$(validateLog ${file})
     validationStatus=$?
     [[ validationStatus -ne 0 ]] && logStatus=1