I need to watch files with different extensions, and run an .sh command after every change. With fswatch, I've been able to watch each extension separately, like:
fswatch *.html | (while read; do ./dev.sh; done)
fswatch index-static/*.js | (while read; do ./dev.sh; done)
fswatch index-static/*.scss | (while read; do ./dev.sh; done)
If I run these commands in different terminal windows, I get what I want... triger the .sh command, after a file with (html|scss|js) extensions has changed.
However, I'm not been able to consolidate this into a single command.
This is running on MaxOS El Capitan, if you need to know.
I have no direct experience with fswatch
, but according to the usage you can provide multiple paths at once, e.g.:
fswatch *.html index-static/*.js index-static/*.scss | (while read; do ./dev.sh; done)
Does this work for you?