So, after reading the Blit paper, I thought 'watch' looked pretty
neat and tried to make a simple rc script to act similarly. However,
when I use the script (at the end of this email) to try something
like this:
man -t ls > foo
watch foo | page

page says 'converting from troff to postscript' but then never
actually displays anything. I'm sure there's something basic
I'm forgetting here--can somebody help me figure out what's
wrong?

Here's the code (I apologize if it doesn't meet your standards)


#!/bin/rc
# Watch the specified file for changes; print out the file
# if there are any changes. 

if (~ $#* 1) {
        cat $1
        sum = `{sum $1}
        while () {
                newsum = `{sum $1}
                if (! ~ $sum(1) $newsum(1)) {
                        sum = $newsum
                        cat $1
                }
                sleep 1
        }
} 
if not {
        echo 'Usage: watch <file>'
}

Reply via email to