aboutsummaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorArvindh Rajesh Tamilmani <art@a-30.net>2010-05-19 18:20:10 -0700
committerRuss Cox <rsc@swtch.com>2010-05-19 18:20:10 -0700
commit9fb7a4f7f7b78476d496cac2b83f9006acd7f483 (patch)
treea341b0199b78ef6032ea589247f3ca1b3d1a1248 /bin
parent18ee9a80f1a2f0e95982a90e40fd052fdae1c2c9 (diff)
downloadplan9port-9fb7a4f7f7b78476d496cac2b83f9006acd7f483.tar.gz
plan9port-9fb7a4f7f7b78476d496cac2b83f9006acd7f483.tar.bz2
plan9port-9fb7a4f7f7b78476d496cac2b83f9006acd7f483.zip
bin/", bin/"": simplify
R=rsc CC=codebot http://codereview.appspot.com/953047
Diffstat (limited to 'bin')
-rwxr-xr-xbin/"10
-rwxr-xr-xbin/""21
2 files changed, 9 insertions, 22 deletions
diff --git a/bin/" b/bin/"
index 75528483..e0f7c8f9 100755
--- a/bin/"
+++ b/bin/"
@@ -21,11 +21,7 @@ switch($#*) {
case 0
cmds | tail -1
case *
- cmds | grep '^ '^$"* | {echo; cat} |
- pr -t -n | sort -nr | sort -u +1 | sort -n |
- sed 's/^ *[0-9]+ //' | grep .
+ cmds | grep -n '^ '^$"* | tail -r |
+ sort -u +1 | sort -n |
+ sed 's/^[0-9]+: //'
}
-
-# the silly {echo; cat} gets around pr printing "empty file" when
-# presented with no input.
-
diff --git a/bin/"" b/bin/""
index dcd4fe7a..c77da34d 100755
--- a/bin/""
+++ b/bin/""
@@ -1,19 +1,10 @@
#!/usr/local/plan9/bin/rc
-PROMPT='[^ ]*[%;$#][ ]+'
-
-" $* |
- grep -v '^'$PROMPT'""' |
- tail -1 |
- tee >{wc -l >/tmp/qq.$pid} |
- tee /dev/stderr |
- 9 sed 's/^ '$PROMPT'//' |
- rc
-
-if(~ `{cat /tmp/qq.$pid} 0){
- rm /tmp/qq.$pid
- echo no such command found
+cmd = `{" $* | tail -1}
+if (~ $#cmd 0) {
+ echo no such command found >[1=2]
exit notfound
}
-rm /tmp/qq.$pid
-exit 0
+
+echo ' ' $cmd >[1=2]
+rc -c $"cmd