Created
December 25, 2016 20:30
-
-
Save sxlijin/af73baa72a0f32bf354469468720b1d6 to your computer and use it in GitHub Desktop.
monitor a directory tree with inotifywait, repeat a command when anything in the tree changes
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/bash | |
WATCH_DIR="app/" | |
REPEAT_ON_CHANGES="./node_modules/.bin/webpack --progress" | |
inotifywait -m --exclude '\..*.swp' -e MODIFY -r $WATCH_DIR | \ | |
while true | |
do | |
sleep 0.1 | |
(e=false; while read -t 0.1 d; do echo $d; export e=true ; done; $e) \ | |
&& $REPEAT_ON_CHANGES | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment