Hi All,

perl has a nice way of padding variables to line
up columns:

   print "\t$a", ' 'x($block - length($a)), "\tb:
$b \n";

Is there something similar in bash?  This hurts
my eyes:

# -----------------------------------
space_over()            # echo $1 spaces
{
        i=$1
        while (( $i > 0 )); do
                echo -n " "
                i=$(($i-1))
        done
}

wide=10
vars='abcd bcdef cdefgh defghij'

for v in $vars; do
  echo -en "\tThe length of ($v)"
  space_over "$(($wide-${#v}))"
  echo "is ${#v} and $wide minus ${#v} is
$(($wide-${#v}))"
done
# -----------------------------------

I guess I don't need to mention I'm just learning
bash.

Jim

__________________________________________________
Do you Yahoo!?
Yahoo! Tax Center - File online, calculators, forms, and more
http://tax.yahoo.com
_______________________________________________
vox-tech mailing list
[EMAIL PROTECTED]
http://lists.lugod.org/mailman/listinfo/vox-tech

Reply via email to