plan9port/bin/"

32 lines
521 B
Text
Raw Normal View History

#!/usr/local/plan9/bin/rc
2004-10-17 04:02:55 +00:00
2006-10-12 02:25:31 +00:00
. 9.rc
2004-10-17 04:02:55 +00:00
fn text {
if(~ $winid [0-9]*)
9p read acme/$winid/body
if not if(~ $text9term unix!*)
dial -e $text9term </dev/null
if not
status=''
}
PROMPT='[^ ]*[%;$#][ ]+'
fn cmds {
text | sed -n 's/^'$PROMPT'([^"])/ \1/p'
2004-10-17 04:02:55 +00:00
}
switch($#*) {
case 0
cmds | tail -1
case *
cmds | grep '^ '^$"* | {echo; cat} |
2004-10-17 04:02:55 +00:00
pr -t -n | sort -nr | sort -u +1 | sort -n |
2006-10-12 02:25:31 +00:00
sed 's/^ *[0-9]+ //' | grep .
2004-10-17 04:02:55 +00:00
}
# the silly {echo; cat} gets around pr printing "empty file" when
# presented with no input.