title: Bash: repeat character a variable number of times
body: <p>Per the questions and ruminations in:</p>
  
  <p><a href="https://unix.stackexchange.com/questions/188658/writing-a-character-n-times-using-the-printf-command">https://unix.stackexchange.com/questions/188658/writing-a-character-n-times-using-the-printf-command</a></p>
  
  <p>and</p>
  
  <p><a href="https://stackoverflow.com/questions/5349718/how-can-i-repeat-a-character-in-bash">How can I repeat a character in bash?</a></p>
  
  <p>I would like to learn how one might go about parameterizing the repeat value for a character/string.  For example, the followings works spiffingly:</p>
  
  <pre><code>printf "   ,\n%0.s" {1..5}
  </code></pre>
  
  <p>However, if I wanted to parameterize '5', say:</p>
  
  <pre><code>num=5
  </code></pre>
  
  <p>I cannot seem to get the expansion correct to make this work.  For instance:</p>
  
  <pre><code>printf "   ,\n%0.s" {1..$((num))}
  </code></pre>
  
  <p>fails.</p>
  
  <p>Any thoughts/ideas would be most welcome - I reckon there's a way to do this without having to resort to perl or awk so just curious if poss.</p>
  
  <p>Thanks!</p>