On 07/09/2011 07:27 AM, Eric Blake wrote:
>
> Also seq isn't portable. Therefore, calculate the correct padding
> length directly and use printf to output it at once.
> ---
> tests/test-lib.sh | 9 ++-------
> 1 files changed, 2 insertions(+), 7 deletions(-)
ACK.
On second thought, for the case where ($counter % 40 == 0), we want 40
spaces if $counter is 0, but 0 spaces if $counter is positive. I think
we need a slight tweak. Rather than:
+ len=`expr 40 - \( $counter % 40 \)`
how about:
if test $counter = 0; then
len=40
else
len=`expr 39 - \( \( $counter - 1 \) % 40 \)`
fi
--
Eric Blake eblake(a)redhat.com +1-801-349-2682
Libvirt virtualization library
http://libvirt.org