in reply to printf syntax

Two ways:

  1. Interpolate:

    You need to wrap the variable name in curlies to prevent the 's' being taken as a part of it:

    $space = 5; printf "%${space}s\n", 'x';; x
  2. Let printf fill in the value for you by using the '*' specifier:
    $space = 5; printf "%*s\n", $space, 'x';; x

Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.
RIP PCW It is as I've been saying!(Audio until 20090817)