3 """repeat <shell-command>
5 This simple program repeatedly (with 1-second intervals) executes the
6 shell command given on the command line and displays the output (or as
7 much of it as fits on the screen). It uses curses to paint each new
8 output on top of the old output, so that if nothing changes, the
9 screen doesn't change. This is handy to watch for changes in e.g. a
10 directory or process listing.
12 To end, hit Control-C.
15 # Author: Guido van Rossum
17 # Disclaimer: there's a Linux program named 'watch' that does the same
18 # thing. Honestly, I didn't know of its existence when I wrote this!
20 # To do: add features until it has the same functionality as watch(1);
21 # then compare code size and development time.
32 cmd
= " ".join(sys
.argv
[1:])
33 p
= os
.popen(cmd
, "r")
37 print >>sys
.stderr
, "Exit code:", sts
49 p
= os
.popen(cmd
, "r")
53 print >>sys
.stderr
, "Exit code:", sts