inotify-wait

inotify-wait

TLDR

Run a command when a file changes

>_ while inotifywait [path/to/file]; do [command]; done
copy

Be quiet about watching for changes

>_ while inotifywait --quiet [path/to/file]; do [command]; done
copy

Watch a directory recursively for changes

>_ while inotifywait --recursive [path/to/directory]; do [command]; done
copy

Exclude files matching a regular expression

>_ while inotifywait --recursive [path/to/directory] --exlude '[regex]'; do [command]; done
copy

Wait at most 30 seconds

>_ while inotifywait --timeout [30] [path/to/file]; do [command]; done
copy

Only watch for file modification events

>_ while inotifywait --event [modify] [path/to/file]; do [command]; done
copy

Copied to clipboard
free 100$ digital ocean credit