tldr/pages/common/entr.md

21 lines
566 B
Markdown
Raw Normal View History

2018-11-26 18:11:43 +00:00
# entr
> Run arbitrary commands when files change.
2021-04-17 16:15:37 +01:00
> More information: <https://manned.org/entr>.
2018-11-26 18:11:43 +00:00
- Rebuild with `make` if any file in any subdirectory changes:
2018-11-26 18:11:43 +00:00
`{{ag -l}} | entr {{make}}`
- Rebuild and test with `make` if any `.c` source files in the current directory change:
`{{ls *.c}} | entr {{'make && make test'}}`
- Send a `SIGTERM` to any previously spawned ruby subprocesses before executing `ruby main.rb`:
`{{ls *.rb}} | entr -r {{ruby main.rb}}`
- Run a command with the changed file (`/_`) as an argument:
`{{ls *.sql}} | entr {{psql -f}} /_`