#!/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
	exit notfound
}
rm /tmp/qq.$pid
exit 0
