tuse all 9 commands (Karl Sackett) - plan9port - [fork] Plan 9 from user space
 (HTM) git clone git://src.adamsgaard.dk/plan9port
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) README
 (DIR) LICENSE
       ---
 (DIR) commit 8ce01b22aea99a47326a3f9e3e774ce90cdbb193
 (DIR) parent 6007b4d97bc6332eaa831d3e9fdd0bad259e0bfe
 (HTM) Author: rsc <devnull@localhost>
       Date:   Thu, 12 Oct 2006 02:25:31 +0000
       
       use all 9 commands (Karl Sackett)
       
       Diffstat:
         M bin/"                               |       8 +++++---
       
       1 file changed, 5 insertions(+), 3 deletions(-)
       ---
 (DIR) diff --git a/bin/" b/bin/"
       t@@ -1,5 +1,7 @@
        #!/usr/local/plan9/bin/rc
        
       +. 9.rc
       +
        fn text {
                if(~ $winid [0-9]*)
                        9p read acme/$winid/body
       t@@ -12,16 +14,16 @@ fn text {
        PROMPT='[^         ]*[%;$#][         ]+'
        
        fn cmds {
       -        text | 9 grep '^'$PROMPT'[^"]' | sed 's/^/        /'
       +        text | grep '^'$PROMPT'[^"]' | sed 's/^/        /'
        }
        
        switch($#*) {
        case 0
                cmds | tail -1
        case *
       -        cmds | 9 grep '^        '$PROMPT^$"* | {echo; cat} |
       +        cmds | grep '^        '$PROMPT^$"* | {echo; cat} |
                        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