Skip to content

Instantly share code, notes, and snippets.

@sleekweasel
Created May 25, 2024 15:22
Show Gist options
  • Save sleekweasel/a5d33f5665b32da15af377d23a9f82ce to your computer and use it in GitHub Desktop.
Save sleekweasel/a5d33f5665b32da15af377d23a9f82ce to your computer and use it in GitHub Desktop.
Polls a command and presents diffs
#!/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