9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* [9fans] newbie rc question
@ 2007-10-15 16:46 john
  2007-10-15 17:22 ` erik quanstrom
  0 siblings, 1 reply; 4+ messages in thread
From: john @ 2007-10-15 16:46 UTC (permalink / raw)
  To: 9fans

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>'
}



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2007-10-15 20:34 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-10-15 16:46 [9fans] newbie rc question john
2007-10-15 17:22 ` erik quanstrom
2007-10-15 20:30   ` john
2007-10-15 20:34     ` erik quanstrom

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).