#!/builddir/build/BUILD/plan9port-0_20260711git.337c6ac-build/plan9port-337c6acbfed51d8d9f08598c6cd398f53abcca7d/bin/rc

. 9.rc

PROMPT='[^ 	]*[%;$#][ 	]+'

fn cmds {
	wintext | 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]+: //'
}
