Skip to content

Instantly share code, notes, and snippets.

@mjf
Created February 13, 2012 09:08
Show Gist options
  • Save mjf/1815251 to your computer and use it in GitHub Desktop.
Save mjf/1815251 to your computer and use it in GitHub Desktop.
FRATE - Print file grow rate in Kbps
#! /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