Blob


1 #!/usr/local/plan9/bin/rc
3 . 9.rc
5 fn text {
6 if(~ $winid [0-9]*)
7 9p read acme/$winid/body
8 if not if(~ $text9term unix!*)
9 dial -e $text9term </dev/null
10 if not
11 status=''
12 }
14 PROMPT='[^ ]*[%;$#][ ]+'
16 fn cmds {
17 text | sed -n 's/^'$PROMPT'([^"])/ \1/p'
18 }
20 switch($#*) {
21 case 0
22 cmds | tail -1
23 case *
24 cmds | grep '^ '^$"* | {echo; cat} |
25 pr -t -n | sort -nr | sort -u +1 | sort -n |
26 sed 's/^ *[0-9]+ //' | grep .
27 }
29 # the silly {echo; cat} gets around pr printing "empty file" when
30 # presented with no input.