Execute python file on change fswatch

fswatch tracks file system events. Execute a command on file change (taken from 1 as reference to search in the future):

fswatch -0 file.py | xargs -0 -I {} command

Explanation:

  • -O split record by NUL character

  • xargs -O matches fswatch splitting

  • -I run given command on each file changes

Footnotes

  1. How to Use fswatch