shithub: bin.rc

ref: 7888f0d7ab5dbd4f0a92cef3730590a4c7b9bea8
dir: /bin/last/

View raw version
#!/bin/rc

# Repeats on standard output the textual output
# of the last command in a current rio window.
# May be considered a complement to "(1).

awk '
	/^'^$prompt(1)^'/ {clear = 1; next}
	{
		if(clear){
			clear = 0
			i = 0
			delete buf
		}
		buf[i++] = $0
	}
	END{
		for(i=0; i<length(buf); i++)
			print buf[i]
	}
' /dev/text