Created
May 29, 2015 19:31
-
-
Save ongardie/85c863bb52106cb8017e to your computer and use it in GitHub Desktop.
Print changes over time in program output
This file contains 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 | |
out1=$(mktemp) | |
out2=$(mktemp) | |
$* > $out1 | |
date -u --rfc-3339=ns | |
cat $out1 | |
echo | |
while true; do | |
sleep ${FREQ:-2} | |
$* > $out2 | |
if ! diff -q $out1 $out2 > /dev/null; then | |
date -u --rfc-3339=ns | |
diff -u $out1 $out2 | |
echo | |
mv $out2 $out1 | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
TODO: clean up temp files