Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/sh
- md5=
- file="${1:-Recovery.log}"
- while :; do
- sleep 1
- _md5=$( md5 "$file" | awk '{print $NF}' )
- [ "$md5" != "$_md5" ] || continue
- pos=$( awk '/current/{getline;print $1}' "$file" )
- line=$( awk -v pos=$pos '$1==pos{line=NR}END{print line}' "$file" )
- lc=$( wc -l "$file" | awk '{print $1}' )
- pct="?"
- [ $line -le 4 ] || pct=$( echo "scale=2;$line*100/$lc" | bc )
- printf "%s @%d/%d %s (%.2f%%) %s\n" \
- "$( date )" "$line" "$lc" "$pos" "$pct" "$file"
- md5="$_md5"
- done
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement