- 1 DATE=$(date +%s)
- 2 count=$(grep -c "" short.txt)
- 3 while true
- 4 do
- 5 DATE_New=$(date +%s)
- 6 if (( $(date +%s) == DATE+1)) #have passed 1 second
- 7 then
- 8
- 9 DATE=$(date +%s)
- 10 count_new=$(grep -c "" short.txt)
- 11 add=$((count_new - count))
- 12 if [ ! -n "$add" ]
- 13 then
- 14 add=0
- 15 fi
- 16 echo add line number is:$add
- 17 count=$count_new
- 18 fi
- 19 done
转载于:https://www.cnblogs.com/JoykingXu0814/p/4157956.html