How do I run a script every time I save a file in Linux?

后端 未结 2 537
后悔当初
后悔当初 2020-12-17 05:57

How do I run a script every time I save a file in Linux?

2条回答
  •  暖寄归人
    2020-12-17 06:19

    I was trying to do the same thing and ended up writing a python script to do it for me.

    https://github.com/bawigga/spy

    usage:

    $ ./spy myscript.py
    ... your script output ...
    
    $ ./spy --help
    Usage: spy [OPTIONS] [WATCH]
    
    Options:
      --version             show program's version number and exit
      -h, --help            show this help message and exit
      -c, --clear           clear the screen after each execution
      -e COMMAND, --exec=COMMAND
                            path to the program to execute
      -i INTERVAL, --interval=INTERVAL
                            (in seconds) set the time interval to check for file
                            modifications
    

提交回复
热议问题