소스 검색

add:logr.sh

wangzhiyong 9 달 전
부모
커밋
5dade7bc6e
1개의 변경된 파일2개의 추가작업 그리고 2개의 파일을 삭제
  1. 2 2
      logr.sh

+ 2 - 2
logr.sh

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