9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: john@csplan9.rit.edu
To: 9fans@cse.psu.edu
Subject: [9fans] newbie rc question
Date: Mon, 15 Oct 2007 12:46:12 -0400	[thread overview]
Message-ID: <132f7ab76fee59596efcab59956f6c36@csplan9.rit.edu> (raw)

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	other threads:[~2007-10-15 16:46 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-10-15 16:46 john [this message]
2007-10-15 17:22 ` erik quanstrom
2007-10-15 20:30   ` john
2007-10-15 20:34     ` erik quanstrom

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=132f7ab76fee59596efcab59956f6c36@csplan9.rit.edu \
    --to=john@csplan9.rit.edu \
    --cc=9fans@cse.psu.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).