bin/", bin/"": simplify
R=rsc CC=codebot http://codereview.appspot.com/953047
This commit is contained in:
parent
18ee9a80f1
commit
9fb7a4f7f7
2 changed files with 9 additions and 22 deletions
10
bin/"
10
bin/"
|
|
@ -21,11 +21,7 @@ switch($#*) {
|
||||||
case 0
|
case 0
|
||||||
cmds | tail -1
|
cmds | tail -1
|
||||||
case *
|
case *
|
||||||
cmds | grep '^ '^$"* | {echo; cat} |
|
cmds | grep -n '^ '^$"* | tail -r |
|
||||||
pr -t -n | sort -nr | sort -u +1 | sort -n |
|
sort -u +1 | sort -n |
|
||||||
sed 's/^ *[0-9]+ //' | grep .
|
sed 's/^[0-9]+: //'
|
||||||
}
|
}
|
||||||
|
|
||||||
# the silly {echo; cat} gets around pr printing "empty file" when
|
|
||||||
# presented with no input.
|
|
||||||
|
|
||||||
|
|
|
||||||
21
bin/""
21
bin/""
|
|
@ -1,19 +1,10 @@
|
||||||
#!/usr/local/plan9/bin/rc
|
#!/usr/local/plan9/bin/rc
|
||||||
|
|
||||||
PROMPT='[^ ]*[%;$#][ ]+'
|
cmd = `{" $* | tail -1}
|
||||||
|
if (~ $#cmd 0) {
|
||||||
" $* |
|
echo no such command found >[1=2]
|
||||||
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
|
|
||||||
exit notfound
|
exit notfound
|
||||||
}
|
}
|
||||||
rm /tmp/qq.$pid
|
|
||||||
exit 0
|
echo ' ' $cmd >[1=2]
|
||||||
|
rc -c $"cmd
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue