Watch a directory, file, or files for changes and run a command.
$ watch [-n] <path> [<cmd>...]When multiple changes happen quickly changes are buffered and grouped into one event.
cmdis ran once per event-nsplits the filenames of an event onto new lines. By default they are seperated by a colon.
$ watch Source/ make
$ watch js/ npm run build
$ watch -n js/ | xargs -I '%' cat %$ make installCompiling with Swift 3.1
Most watch utilites either poll on an interval or require complicated configuration. This uses FSEvents and has a simple api.