title: How to printf align my output like a table?
body: <p>How do I printf align my output like a table?</p>
  
  <pre><code>Title                                             Author
  BaokyBook                                              Baoky2
  Use basename commandUse basename command ..             Baoky
  </code></pre>
  
  <p>My partial code is like this</p>
  
  <pre><code>titlelength=${#title};
  </code></pre>
  
  <p>First I get the title length, then I printf like this</p>
  
  <pre><code>titlespace=`expr 60 - titlelength`;
  printf "%s %${titlespace}s\n" "$title" "$author"
  </code></pre>
  
  <p>But the alignment is not right, how do I get it working well aligned </p>
  
  <p>In reply to the answer below:</p>
  
  <p>after making the changes</p>
  
  <p>all my left align to the right. and it doesn't seems working.</p>