aboutsummaryrefslogtreecommitdiff
path: root/bin/quote1
blob: f52480fd1e9291c42207702fcf15157e57dc6a3d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#!/usr/local/plan9/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]+: //'
}