That's very elegant. Some new (to me) constructs to study. Thanks! Kenneth D. Weinert wrote: > #!/bin/bash > > declare -i in > declare -i out > > ((in = 0)) > ((out = 0)) > while read direction amount; do > if [ "$direction" == "i" ];then > ((in += $amount)) > else > ((out += $amount)) > fi > done > > echo "Input: $in" > echo "Output: $out"