about summary refs log tree commit diff
RWC(1)                      General Commands Manual                     RWC(1)

NAME
     rwc – report when changed

SYNOPSIS
     rwc [-0cdep] [path ...]

DESCRIPTION
     rwc takes a list of files or directories, watches them using inotify(7),
     and prints each file name as absolute path when it changed.  If path is a
     single dash (‘-’) or absent, rwc reads file names from the standard
     input.

     Watching a directory will result in watching all changes to files which
     resides directly in that directory.

     The options are as follows:

     -0      Read input filenames seperated by NUL bytes.  Likewise, output
             filenames seperated by NUL bytes.

     -c      Detect all file creations, including open(2) with O_CREAT,
             mkdir(2), link(2), symlink(2), and bind(2).  In this case,
             created files are prefixed by ‘+ ’ (that is, a plus and a space).
             This option has the side-effect of printing files twice that are
             created and immediately changed after.

     -d      Also detect file deletion.  In this case, deleted files are
             prefixed by ‘- ’ (that is, a dash and a space).

     -e      Exit after the first reported change.

     -p      Pipe mode; don't report changes while the standard output pipe is
             not empty.  Use this to pipe rwc to programs which read standard
             input slowly.

EXIT STATUS
     The rwc utility exits 0 on success, and >0 if an error occurs.

EXAMPLES
     Watch all source files and run make(1) when something changes:

           % git ls-files | rwc -p | xe -v -s make

     Make a sound when a download is done:

           % rwc ~/Downloads | xe -s 'mpv ~/.sounds/bing.wav'

SEE ALSO
     entr(1), inotifywatch(1), wendy(1)

AUTHORS
     Leah Neukirchen <leah@vuxu.org>

CAVEATS
     rwc is limited by some restrictions of inotify(7).  You can only watch
     files and directories you can read, and the amount of inotify descriptors
     is limited.  Watching directories is not recursive.

     rwc only uses one watch descriptor per directory, and filters file names
     itself.  This allows tracking files which get safely written by unlink(2)
     and rename(2), and also watching files which don't exist yet.

     Many tools like to create temporary files in their working directory,
     which may distort the output.

LICENSE
     rwc is in the public domain.

     To the extent possible under law, the creator of this work has waived all
     copyright and related or neighboring rights to this work.

     http://creativecommons.org/publicdomain/zero/1.0/

Void Linux                      January 3, 2021                     Void Linux