wangzhiyong 1 rok temu
rodzic
commit
3260f018ca
1 zmienionych plików z 2 dodań i 2 usunięć
  1. 2 2
      log.sh

+ 2 - 2
log.sh

@@ -15,9 +15,9 @@ fi
 while [ $count -lt 5 ]
 do
   if [ -z "$3" ]; then
-    file=$(ls -t "$dir" | grep "error" | head -n 1)
+    file=$(ls -t "$dir" | grep "error" | head -n $((count + 1)) | tail -n 1)
   else
-    file=$(ls -t "$dir" | grep -v "$3" | head -n 1 )
+    file=$(ls -t "$dir" | grep -v "$3" | head -n $((count + 1)) | tail -n 1 )
   fi
   
   if [ -z "$file" ]; then