mirror of
https://github.com/9fans/plan9port.git
synced 2025-01-12 11:10:07 +00:00
9fb7a4f7f7
R=rsc CC=codebot http://codereview.appspot.com/953047
27 lines
393 B
Bash
Executable file
27 lines
393 B
Bash
Executable file
#!/usr/local/plan9/bin/rc
|
|
|
|
. 9.rc
|
|
|
|
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'
|
|
}
|
|
|
|
switch($#*) {
|
|
case 0
|
|
cmds | tail -1
|
|
case *
|
|
cmds | grep -n '^ '^$"* | tail -r |
|
|
sort -u +1 | sort -n |
|
|
sed 's/^[0-9]+: //'
|
|
}
|