title: Parameter expansion for array elements in a loop
body: <p>I am trying to check if all the environment variables are defined.</p>
  <p>Test for individual element works fine as defined below:</p>
  <pre><code>[ -z ${env_var1:+y} ] &amp;&amp; echo &quot;Env var not defined.&quot;
  </code></pre>
  <p>Although I need to check this for multiple elements, hence want to add it in the loop. But somehow it is not working:</p>
  <pre><code>env_var_array=( env_var1 env_var2 env_var3 )
  for element in &quot;${env_var_array[@]}&quot;
  do
    [ -z ${element:+y} ] &amp;&amp; echo &quot;$element var not defined.&quot;
  done
  </code></pre>
  <p>It is not working as expected.</p>