aboutsummaryrefslogtreecommitdiff
path: root/watch.1
blob: a60954737b31ac0d822a1c2cd812a2721f0585a2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
.Dd $Mdocdate$
.Dt WATCH 1
.Os
.Sh NAME
.Nm watch
.Nd a simple file watcher
.
.Sh SYNPOSIS
.Nm watch
.Op Fl i
.Ar file ...
.
.Sh DESCRIPTION
.Pp
.Nm watch
is a simple program that watches any given
.Ar file
for changes.
When the file changes, its name (as specified in the arguments to
.Nm watch )
is printed on standard output.
.Pp
If the
.Fl i
argument is provided, an initial such line is printed when the program
starts, before beginning to watch for changes.
.
.Sh ERRORS
.Pp
If one of the watched files is deleted, a message is printed on standard
error and the program exits with error code 1.
.Pp
If a file is renamed, a notice is printed on standard error, but the
program keeps running.
.\"
.Sh EXAMPLES
.Bd -literal -offset indent
$ watch *.ms | while read file; do
	make ${file%.ms}.pdf && kill -9 mupdf
done
.Ed
.Bd -literal -offset indent
$ alias each='xargs -L0 -I {}'
$ watch -i * | each cp {} /mnt/usb/
.Ed
.
.Sh AUTHORS
.Pp
.Nm watch
is written by
.An John Ankarström Aq Mt "john (at) ankarstrom.se" .