Skip to content

Instantly share code, notes, and snippets.

@jlongman
Created May 11, 2015 19:35
Show Gist options
  • Save jlongman/276b106f1428013c2125 to your computer and use it in GitHub Desktop.
Save jlongman/276b106f1428013c2125 to your computer and use it in GitHub Desktop.
line looper
#!/bin/sh
# use line-lite.sh: https://brianin3d.wordpress.com/2008/05/14/scripting-with-ansi-color-codes/
TMPFILE1=`mktemp /tmp/${tempfoo}.XXXXXX` || exit 1
TMPFILE2=`mktemp /tmp/${tempfoo}.XXXXXX` || exit 1
while `true`; do
COLS=`stty size | awk '{print $2}'`
eval "$@" > $TMPFILE1
clear;
# diff -W$COLS -y $TMPFILE1 $TMPFILE2
diff --left-column -W$COLS -y $TMPFILE1 $TMPFILE2 | ~/bin/line_lite.sh ".*|.*" bright ".*<.*" green ".*>.*" red
mv $TMPFILE1 $TMPFILE2
sleep 2;
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment