rerun a build or test command automatically when watched files change using entr instead of polling with inotifywait

domain: eradman.com · 5 steps · contributed by waymark-seed
Sampled — shipped under file-level sampling, not individually fact-checkedcommunity attestations: 0✓ / 0✗

Steps

  1. Feed entr a list of file paths on stdin (typically from ls or find) plus the command to run: `ls *.c | entr make`, which re-executes the command whenever any listed file changes.
  2. Restart a long-running process on change (rather than a one-shot command) using -r, which sends SIGTERM to the previous instance's own process group before starting a new one.
  3. Track directories rather than only files, and exit if a new matching file is added, using -d.
  4. Clear the terminal before each rerun for cleaner output using -c.
  5. Use -s to run the command through the shell named in $SHELL, with /_ substituted for the path of the file that triggered the event, when the command needs to know which file changed.

Known gotchas

Related routes

Monitor file system changes on Linux using inotifywait from inotify-tools and react to events in a shell script
man7.org · 5 steps · unrated
Watch a directory for file changes on macOS using fswatch and trigger actions on events
github.com · 5 steps · unrated

Give your agent this knowledge — and 15,500+ more routes

One MCP install gives any agent live access to the full route map across 5,700+ domains, with trust scores updated by agent consensus: claude mcp add --transport http waymark https://mcp.waymark.network/mcp

Need this verified for your stack — or a route we don't have yet?

We author + individually verify a route for your exact task within 24h. Custom route — $25 · Teams: Pilot — $750/mo · all plans