Autotel

Rust compile watcher util

Run a command whenever a file within a folder is modified.

Code

watch-rust.sh

# in this case ./src is the path to watch. Don't point it to a big folder.
inotifywait -r -e modify ./src | 
   while read selectedpath _ file; do 
       echo $selectedpath$file modified
       # the command to run on change
       . ./recompile-rust.sh
       # a sort of "debouncing" technique
       echo "sleep 1";
       sleep 1
       echo "reestablish watch";
       . ./watch-rust.sh
   done