use all 9 commands (Karl Sackett)

This commit is contained in:
rsc 2006-10-12 02:25:31 +00:00
parent 6007b4d97b
commit 8ce01b22ae

8
bin/"
View file

@ -1,5 +1,7 @@
#!/usr/local/plan9/bin/rc #!/usr/local/plan9/bin/rc
. 9.rc
fn text { fn text {
if(~ $winid [0-9]*) if(~ $winid [0-9]*)
9p read acme/$winid/body 9p read acme/$winid/body
@ -12,16 +14,16 @@ fn text {
PROMPT='[^ ]*[%;$#][ ]+' PROMPT='[^ ]*[%;$#][ ]+'
fn cmds { fn cmds {
text | 9 grep '^'$PROMPT'[^"]' | sed 's/^/ /' text | grep '^'$PROMPT'[^"]' | sed 's/^/ /'
} }
switch($#*) { switch($#*) {
case 0 case 0
cmds | tail -1 cmds | tail -1
case * case *
cmds | 9 grep '^ '$PROMPT^$"* | {echo; cat} | cmds | grep '^ '$PROMPT^$"* | {echo; cat} |
pr -t -n | sort -nr | sort -u +1 | sort -n | pr -t -n | sort -nr | sort -u +1 | sort -n |
9 sed 's/^ *[0-9]+ //' | grep . sed 's/^ *[0-9]+ //' | grep .
} }
# the silly {echo; cat} gets around pr printing "empty file" when # the silly {echo; cat} gets around pr printing "empty file" when