entr is a Command Line Interfacetool that will watch for changes in the filesystem and execute a command if a file changes on disk.

You pass a list of files to monitor - and then say which command to run.

Example using ls:

ls *.rules | entr -c bash -c "<command>"

Example using rg (which will see all files under version control :

rg --files static/ index.html | entr python3 export.py