diff options
Diffstat (limited to 'bin/quote1')
-rwxr-xr-x | bin/quote1 | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/bin/quote1 b/bin/quote1 new file mode 100755 index 00000000..e0f7c8f9 --- /dev/null +++ b/bin/quote1 @@ -0,0 +1,27 @@ +#!/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]+: //' +} |