annotate cpack/dml/scripts/compression/rptlen @ 0:718306e29690 tip

commiting public release
author Daniel Wolff
date Tue, 09 Feb 2016 21:05:06 +0100
parents
children
rev   line source
Daniel@0 1 #!/usr/bin/env bash
Daniel@0 2 # Insert rptlen into a pipeline to report the number of bytes passing through.
Daniel@0 3 # NB. if the pipeline is terminated early by a later consuming process, the
Daniel@0 4 # byte count will be wrong.
Daniel@0 5 function buflen {
Daniel@0 6 len=$(length)
Daniel@0 7 echo "$1:" $len
Daniel@0 8 }
Daniel@0 9 function buflen2 {
Daniel@0 10 length | sed -e "s/^/$1:/"
Daniel@0 11 }
Daniel@0 12 tee >(buflen2 "$1" 1>&2)