title: Pad a string to a certain length with a chosen character (or hexcode) in Bash?
body: <p>I want to pad a string in Bash to a certain length with any chosen character (or hexcode).</p>
  
  <p>Suppose I have the string <code>AABB</code> and want to pad it using <code>X</code> or (<code>0x00</code>) to length 10:</p>
  
  <p><code>AABBXXXXXX</code></p>
  
  <p>I know how to pad with spaces using <code>printf</code>. How can I pad with an arbitrary character (or hexcode)?</p>