#!/builddir/build/BUILD/plan9port-0_20261021git.1f13969-build/plan9port-1f1396913fb5372408f442ed26933f5ae4b399cd/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]+: //'
}
