9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: "rob pike" <rob@plan9.bell-labs.com>
To: 9fans@cse.psu.edu
Subject: [9fans] History
Date: Thu,  9 Nov 2000 13:34:57 -0500	[thread overview]
Message-ID: <20001109183459.1DEAA199F1@mail.cse.psu.edu> (raw)

Now that you've recovered your breath from laughing uproariously at my
joke this morning - oh, was that politics you were laughing at?  sorry
- anyway, here's what I do for history.  I've sent them before but I
keep tweaking them and maybe it's time to send them again.  You need
to fix the pattern to match your prompt.  It's an exercise for the
reader to see how they work and how to use them.  Based on an idea
from rsc, I think.  I hardly ever use them when I have a mouse, but if
I'm stuck with a nipple-mouse I use them a lot.

-rob

% cat /bin/"
#!/bin/rc

rfork en

if(test -r /mnt/acme/acme/body)
	bind /mnt/acme/acme/body /dev/text

PROMPT='[^ 	]*%+[ 	]+'

fn cmds {
	grep '^'$PROMPT'[^"]' /dev/text | sed 's/^/	/'
}

switch($#*) {
case 0
	cmds | tail -1
case *
	cmds | grep '^	'$PROMPT^$"* | {echo; cat} |
		pr -t -n | sort -nr | sort -u +1 | sort -n |
		sed 's/^ *[0-9]+	//' | grep .
}

# the silly {echo; cat} gets around pr printing "empty file" when
# presented with no input.
% cat /bin/""
#!/bin/rc

rfork e

PROMPT='[^ 	]*%+[ 	]+'

_x = `{" $* | tail -1}
if(~ $#_x 0) {
	echo no such command found
	exit notfound
}

echo $_x
_x=`{ echo -n 'eval '; echo $_x | sed 's/^'$PROMPT'//'}
rc -c $"_x
% 



             reply	other threads:[~2000-11-09 18:34 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-11-09 18:34 rob pike [this message]
2001-01-03 20:57 ` [9fans] Need the CS Troff Font to Print the Sam Tutorial Mark C. Otto
2001-08-30 14:58 ` [9fans] How to use POP3 as Part of upas/fs Mark Otto
  -- strict thread matches above, loose matches on Subject: below --
2006-07-07 15:21 [9fans] history Fco. J. Ballesteros
2006-07-07 16:16 ` Skip Tavakkolian
2002-01-22 20:43 rob pike
2000-11-14 21:39 [9fans] History presotto
2000-11-14 21:46 ` Boyd Roberts
2000-11-14 20:45 Richard Miller
2000-11-14 19:12 anothy
2000-11-14 19:37 ` Boyd Roberts
2000-11-14 17:21 rog
2000-11-14 14:28 rob pike
2000-11-14 15:12 ` Boyd Roberts
2000-11-09 16:39 forsyth
2000-11-10  9:35 ` Douglas A. Gwyn
2000-11-14  9:33   ` George Michaelson
2000-11-14  9:51     ` Boyd Roberts
2000-11-14 15:50       ` Douglas A. Gwyn
2000-11-14 16:13         ` Boyd Roberts
2000-11-09 16:15 rog
2000-11-09 15:26 ` Boyd Roberts
2000-11-09 14:01 rob pike
2000-11-09 14:50 ` Boyd Roberts
2000-11-09 15:20   ` Axel Belinfante

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=20001109183459.1DEAA199F1@mail.cse.psu.edu \
    --to=rob@plan9.bell-labs.com \
    --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).