entr
Run arbitrary commands when files change.
Rebuild when files changed
To rebuild a project whenever a source file changes:
find src | entr make
Rebuild when files added
You can use -d
to have entr
exit if new files are added to the directories of files provided as input. Combine it with a loop, and you can monitor those new files too:
while sleep 0.1; do find src | entr -d make; done
Reload a process
To launch and auto-reload a Node.js server:
ls *.js | entr -r node app.js
Monitor via git ls-files
Instead of using find
or ls
, it may be more convenient to rely on git
:
git ls-files -cdmo --exclude-standard | entr make