title: bash: [: 1+1: integer expression expected
body: <p>I have a main directory with 40 subdirectories with names <code>[Set 1]</code>, <code>[Set 2]</code> ... <code>[Set 40]</code>, each containing 20 wallpapers with name <code>1.jpg</code>, <code>2.jpg</code>, ... <code>20.jpg</code>. I want to move all these wallpapers to the main directory and rename them as <code>1.jpg</code>, <code>2.jpg</code> ... <code>800.jpg</code>. I wrote the following Bash script but getting error.</p>
  
  <pre><code>i=1; j=1; k=1;
  while [ $i -ne 41 ]; do
    j=1;
    while [ $j -ne 21 ]; do
      mv \[Set\ $i\]/$j.jpg $k.jpg;
      j=$j+1;
      k=$k+1;
    done;
    i=$i+1;
  done
  </code></pre>
  
  
  
  <pre><code>bash: [: 1+1: integer expression expected
  bash: [: 1+1: integer expression expected
  </code></pre>
  
  <p>Where am I making a mistake?</p>