The (command line) interface I have in mind is like so:
watching FILE+ do COMMAND [ARGS] (and COMMAND [ARGS])*
Where any occurrence of \"
You can use entr, e.g.
ls foo.txt bar.txt | entr sh -c 'rsync -vuar *.txt somewhere.com:. && echo Updated'
Unfortunately you can't check which file has been changed, but using rsync -u
will automatically skip files which haven't been changed.
Here is the second example:
ls foo.c | entr sh -c 'gcc foo.c && ./a.out'
or simply use make
, e.g.
ls -d * | entr sh -c 'make && make test'
To watch the directory for changes, use -d
parameter wrapped inside a shell loop, e.g.:
while true; do find path/ | entr -d do_stuff; done