subtracting variables in ksh

hi all,
how do i subract variables in shell ?? am trying to space out the headers and the output generated by the shell so they all line up :

currently the output is like this :

servers         :      users

server1         :      10
latestServer         :       50

so i thought i would keep a constant e.g 40 and subtract the length of the server name from it.

count=${#myserver};       # this is the length of the server name
spaces=((40 - $count ));  # this doesnt really work

thanks in advance.

you were almost there :slight_smile:

spaces=$((40-$count))

((spaces=40-count))

That is non-standard. For example:

$ count=3
$ ((spaces=40-count))
$ printf ":%s:\n" "$spaces"
::
$ spaces=$((40 - $count))
$ printf ":%s:\n" "$spaces"
:37: