Created
December 20, 2012 17:06
-
-
Save nicerobot/4346785 to your computer and use it in GitHub Desktop.
simple directory watching for new files.
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 | |
watch() { | |
touch .newer | |
while :; do | |
find . -type f -newer .newer \ | |
| grep -v .newer \ | |
| while read f; do | |
process_watch ${f} | |
touch .newer | |
done | processall_watches | |
sleep 1 | |
done | |
} | |
process_watch() { echo $1; } | |
processall_watches() { cat; } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment