Created
March 8, 2018 03:32
-
-
Save hackerb9/d666f5668e87a6f3dce0afb8df09aa2a to your computer and use it in GitHub Desktop.
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/bash | |
# Watch files in the current working directory (or given argument) | |
# display how much a file has grown in the last second (or so) | |
# B9 2018 | |
if [ -d "$1" ]; then | |
cd "$1" | |
shift | |
fi | |
orig=$(stat --format=$'%n\t%s' *) | |
old="$orig" | |
while sleep 1; do | |
new=$(stat --format=$'%n\t%s' *) | |
join <(echo "$old") <(echo "$new") | | |
awk -v tick="'" \ | |
'$2 != $3 { printf ("%" tick "*d %s\n", 20, $3-$2, $1) }' | |
old="$new" | |
echo | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment