Uses inotify(7) to wait until file(s) change; utility for use in scripts.
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
.gitignore
LICENSE
Makefile
README
unchanged.c

README

USAGE

unchanged - waits until file(s) change.
Usage: unchanged FILE [FILES...]
  Waits until the inotify kernel facility indicates one of FILE changed.
  Exit Status: index of changed file in argument list (starts with 1).


BUILDING

Simple invocation of

$ make clean all

should be sufficient to build. Copy ./bin/unchanged to somewhere in your path to
use.


DESCRIPTION

Unchanged makes it easy to add inotify(7) functionality to a script. This is
useful any time one wants to execute something whenever a file changes. For
instance, this project is built with every modification to a source file as
follows:

$ while ! unchanged $(make echo); do make; done;

The echo target in the make file outputs a list of sources, which unchanged then
monitors for changes. Unchanged exits with non-zero status when a file
changes. The exit code is the 1-indexed position of the first changed file in
the argument list.


IDEAS

* Support verbose output via an environmental variable
* Use exit code 0 to indicate change via environmental variable

BUGS

* If you monitor more than 255 files simultaneously, exit codes will wrap.