title: Bash won't change variable value
body: <p>I am trying to change the variable <code>reload</code> from <code>0</code> to <code>1</code> as you can see in my code below: </p>
  
  <pre><code>for d in /home/*; do
    u="${d##*/}";
    reload=0;
    echo "Checking $u";
    if [ -e /home/$u/info/reload.php ]; then
      echo "FOUND!";
      reload=1;
    fi
  done
  echo $reload;
  if [ $reload = 1 ]; then
    service apache2 reload
  fi
  </code></pre>
  
  <p>The problem is that it doesn't get changed, <code>$reload</code> remains as <code>0</code>, the output is similar to this (apache does not get reloaded):</p>
  
  <pre><code>Checking user1
  FOUND!
  Checking user2
  0 #&lt; this should be 1 not 0 :(
  </code></pre>
  
  <p>Why won't my bash variable change??</p>