watch: exit when command output changes.

Add new flags to watch (-g/--chgexit) so that it exits when the
output changes.  This is useful in builds and shell scripts, for
example when deploying webapps to block the remainder of the
deployment steps until after the webapp starts.

e.g. watch --chgexit curl http://foo/bar
This commit is contained in:
Kent R. Spillner
2012-01-26 08:42:37 -06:00
parent 8955ec26fe
commit 81f64657ba
2 changed files with 27 additions and 4 deletions

View File

@@ -11,6 +11,7 @@ runs
repeatedly, displaying its output and errors (the first screenfull). This
allows you to watch the program output change over time. By default, the
program is run every 2 seconds.
By default,
.B watch
will run until interrupted.
.SH OPTIONS
@@ -44,6 +45,11 @@ Beep if command has a non-zero exit.
\fB\-e\fR, \fB\-\-errexit\fR
Freeze updates on command error, and exit after a key press.
.TP
\fB\-g\fR, \fB\-\-chgexit\fR
Exit when the output of
.I command
changes.
.TP
\fB\-c\fR, \fB\-\-color\fR
Interpret ANSI color sequences.
.TP