title: Stripping leading zeros using bash substring removal only
body: <p><em>I am aware of other ways to solve this problem that do work (and I am currently using the 'expr' method), but it bugs me that I cannot figure out how to do it with the bash built-in functions only.</em></p>
  
  <p>When I try to strip the leading zeros from a variable using the ${variable##remove} construct I can either only get it to remove one zero or all numbers.</p>
  
  <pre><code>string="00123456"
  echo "${string##0}" // Only the first 0 is removed
  echo "${string##0*0}" // The whole string is removed
  echo "${string#0*0}" // Works
  
  string="01230"
  echo "${string##0}" // Works
  echo "${string##0*0}" // The whole string is removed
  echo "${string#0*0}" // Again, the whole string is removed
  </code></pre>
  
  <p>I read the bash manual twice to see if I am doing it correctly, but the official documentation is sparse at best. I am aware that enabling extglob may also solve this problem but it seems like overkill for a problem as simple as this.</p>
  
  <p>Am I missing something obvious or is it really that hard to remove one or more leading zeros from a string using bash functions only?</p>