Created
May 25, 2024 15:22
-
-
Save sleekweasel/a5d33f5665b32da15af377d23a9f82ce to your computer and use it in GitHub Desktop.
Polls a command and presents diffs
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 | |
# Poll command and display diffs. e.g. diffpoller.sh lsusb | |
BASE=/tmp/$(whoami)-$(basename $0) | |
trap "rm -f $BASE-A $BASE-B ; exit" SIGINT | |
echo -n > $BASE-B | |
while true ; do | |
"$@" > $BASE-A 2>&1 | |
diff -wu $BASE-B $BASE-A || date | |
mv $BASE-A $BASE-B | |
sleep 4 | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment