Last active
January 24, 2020 12:15
-
-
Save ilyaglow/f1a09c4c0c956b48fae75d2225f9cebf to your computer and use it in GitHub Desktop.
Simple primitive to monitor output of the command: DISC (do if something changed)
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/sh | |
FIRST=y | |
sh -c "$CMD" > .prev-output | |
while : | |
do | |
if [[ "$FIRST" == "y" ]]; then | |
FIRST="n" | |
sleep "$SLEEP" | |
continue | |
fi | |
sh -c "$CMD" > .output | |
sh -c "comm -1 -3 .prev-output .output || < .output ${TRIGGER_CMD}" | |
cp .output .prev-output | |
sleep "$SLEEP" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment