Created
September 13, 2013 18:19
-
-
Save icholy/6554201 to your computer and use it in GitHub Desktop.
command output diff
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/sh | |
# | |
# Usage: | |
# | |
# ./diff_exec.sh lsof -p <PID> | |
# | |
# Every time you hit enter it will run the command | |
# and display the diff between the current and previous output. | |
# | |
prev_output=prev.out | |
curr_output=curr.out | |
touch $prev_output $curr_output | |
while true; do | |
eval "$@" > $curr_output | |
diff $prev_output $curr_output | colordiff | |
cat $curr_output > $prev_output | |
echo > $curr_output | |
read | |
done; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment