To monitor a file in linux, I can use inotify-tools like this
#!/bin/bash # with inotify-tools installed, watch for modification of file passed as first par
You can use entr tool. Example usage:
ls some_file | entr do_something
On Mac install via Brew: brew install entr.
brew install entr