The current logic tries to count from 1 to 40 and ignores paddings
of 0 and 1 to 40. This doesn't work for counter + 1 mod 40 == 0
like here for counter value 159
TEST: virsh-all
........................................ 40
........................................ 80
........................................ 120
....................................... 159 OK
PASS: virsh-all
Also seq isn't portable. Therefore, calculate the correct padding
length directly and use printf to output it at once.
status=$2
if test "$verbose" = "0" ; then
- mod=`expr \( $counter + 1 \) % 40`
- if test "$mod" != "0" && test "$mod" != "1" ; then
- for i in `seq $mod 40`
- do
- printf " "
- done
- fi
+ len=`expr 40 - \( $counter % 40 \)`
+ printf "%${len}s" ""
if test "$status" = "0" ; then
printf " %-3d OK\n" $counter
else