-
-
Save uskudnik/f8a69c1355e9c9665d77 to your computer and use it in GitHub Desktop.
neo's solution?
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
#!/usr/bin/env bash | |
MYCOMMAND='while [ true ]; do sleep 1; echo "beje"; done' | |
# This will take down the whole process tree on ctrl+c | |
trap "exit" INT TERM | |
trap "kill 0" EXIT | |
while true; do | |
sleep 1; | |
NEW_OUTPUT=`find . -name \*.coffee -exec openssl sha1 {} \;`; | |
if [ "$NEW_OUTPUT" != "$OLD_OUTPUT" ] | |
then | |
# echo "changed!"; | |
if [ "$MYPID" ]; then kill -9 $MYPID; fi | |
bash -c "$MYCOMMAND" & # command will output to stdout | |
MYPID=$! | |
OLD_OUTPUT="$NEW_OUTPUT"; | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment