Created
June 14, 2017 21:06
-
-
Save 3noch/cd25540cc7627055e56c06d1bf6b54db to your computer and use it in GitHub Desktop.
Simple file watching script
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 | |
#You need inotifywait from inotify-tools | |
DIR=${1:?Specify a file or directory to watch} | |
CMD=${2:?Specify a command to run} | |
while true; do inotifywait -qr -e modify -e create -e delete "$DIR"; $CMD; sleep 1; done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment