fswatch
is a good program to react to file changes, e.g. run tests when files
are updated. It's cross-platform.
fswatch path/to/file | xargs -n 1 bash_command
fswatch ./README.md | xargs -I {} -n 1 pandoc -o README.html README.md
fswatch -o ./*.js | xargs -I {} -n 1 npm test