#!/builddir/build/BUILD/plan9port-0_20260827git.b6564bd-build/plan9port-b6564bd96ca189c69e28797738dad56f91eb5967/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]+: //'
}
