#!/usr/bin/env bash
# Insert rptlen into a pipeline to report the number of bytes passing through.
# NB. if the pipeline is terminated early by a later consuming process, the 
# byte count will be wrong.
function buflen {
	len=$(length)
	echo "$1:" $len
}
function buflen2 {
	length | sed -e "s/^/$1:/" 
}
tee >(buflen2 "$1" 1>&2)
