Created
June 27, 2013 15:25
-
-
Save gdetrez/5877405 to your computer and use it in GitHub Desktop.
Poor man's guard: a simple, one line, watch function. For Makefiles or shell scripts.
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
watch = while true; do (inotifywait -qre close_write --format "%w%f" . | grep $1) && $2; done | |
all: | |
$(call watch, 'test/.*.txt', echo "some stuff has 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/bash | |
function watch { | |
while true; do | |
(inotifywait -qre close_write --format "%w%f" . | grep $1) && $2; | |
done | |
} | |
watch 'test/.*.txt' 'echo some stuff has changed...' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment