Created
February 13, 2012 09:08
-
-
Save mjf/1815251 to your computer and use it in GitHub Desktop.
FRATE - Print file grow rate in Kbps
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/sh | |
# FRATE - Print file grow rate in Kbps | |
# Copyright (C) 2012 Matous J. Fialka, <http://mjf.cz/> | |
# Released under the terms of The MIT License | |
if [ $# -ne 1 ] | |
then | |
printf 'usage: frate [file]\n' 1>&2 | |
exit 1 | |
fi | |
CURRENT=`stat -c %s $1` | |
LAST=0 | |
RATE=0 | |
while : | |
do | |
LAST=$CURRENT | |
CURRENT=`stat -c %s $1` | |
RATE=$((((CURRENT-LAST)/1024)*8)) | |
printf '% 9d Kbps\b\b\b\b\b\b\b\b\b\b\b\b\b\b' $RATE | |
sleep 1 | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment