You can use entr , for example
ls foo.txt bar.txt | entr sh -c 'rsync -vuar *.txt somewhere.com:. && echo Updated'
Unfortunately, you cannot check which file has been modified, but using rsync -u will automatically skip files that have not been modified.
Here is a second example:
ls foo.c | entr sh -c 'gcc foo.c && ./a.out'
or just use make , for example
ls -d * | entr sh -c 'make && make test'
To view the change catalog, use the -d , enclosed inside the shell loop, for example:
while true; do find path/ | entr -d do_stuff; done
source share