title: String interpolation in Bash
body: <p>My code</p>
  
  <pre><code>#!/bin/bash
  for (( c=0; c&lt;=1127; c++ ))
  do
  id = 9694 + c
  if (id &lt; 10000); then
      wget http://myurl.de/source/image/08_05_27_0${id}.jpg
  else 
      wget http://myurl.de/source/image/08_05_27_${id}.jpg
  fi
  done 
  </code></pre>
  
  <p>I only get </p>
  
  <pre><code>./get.sh: line 5: 10000: No such file or directory
  --2009-05-06 11:20:36--  http://myurl.de/source/image/08_05_27_.jpg
  </code></pre>
  
  <p>without the number.</p>
  
  <p>The corrected code:</p>
  
  <pre><code>#!/bin/bash
  for (( c=0; c&lt;=1127; c++ ))
  do
  id=$((9694+c))
  if (id -lt 10000); then
      wget http://myurl.de/source/image/08_05_27_0${id}.jpg
  else 
      wget http://myurl.de/source/image/08_05_27_${id}.jpg
  fi
  done 
  </code></pre>
  
  <p>And even better:</p>
  
  <pre><code>for i in $(seq 9694 10821) ; do
      _U=`printf "http://myurl.de/source/image/08_05_27_%05d.jpg" $i`
      wget $_U 
  done
  </code></pre>