Provided by: entr_2.5-1_amd64
entr — run arbitrary commands when files change
entr [-r] utility [arguments ...] entr +fifo
entr has two modes of operation; the first use reads a list of files provided on STDIN and executes the supplied utility if any of them change. entr waits for the child process to finish before responding to subsequent file system events. A TTY is opened before entering the watch loop in order to support the invocation of interactive utilities. -r modifies the exec mode by launching the utility at startup and reloading it if one of the source files change. This features requires the application to exit if it receives SIGTERM. entr always waits for the utility to exit to ensure that resources such as sockets have been closed. The second mode also reads a list of filenames provided on STDIN and is enabled by specifying '+' and the name of a fifo. In this mode entr enables more sophisticated scripting by writing filenames to a named pipe when they are modified.
If PAGER is undefined, entr will assign /bin/cat to prevent interactive utilities from waiting for keyboard input if output does not fit on the screen.
The entr utility does not normally return, but it will exit with a value of 0 if the signal SIGINT or SIGTERM was received. An exit status of 1 indicates that no regular files were provided as input.
Rebuild project when source files change $ find src | entr make Clear the screen and run tests $ ls *.py | entr sh -c 'clear; ./test.py' Launch and auto-reload a node.js server $ ls *.js | entr -r node index.js Convert individual Markdown files to HTML if they're modified $ ls *.md | entr +notify & $ while read F; do > markdown2html $F > done < notify
Only regular files are monitored, directories and special files are ignored.