title: KornShell - grouping conditions in an IF statement
body: <p>I got the following snippet failing on KornShell (ksh):</p>
  
  <pre><code>var1="1"
  var2="2"
  if [ ( "$var1" != "" -o "$var2" != "") -a ( "$var1" = "$var2" -o " "$var1" = "x") ]; then
     echo "True"
  else
     echo "False"
  fi
  </code></pre>
  
  <blockquote>
    <p>ksh: syntax error: `"$var1"' unexpected</p>
  </blockquote>
  
  <p>As I understand, this fails because the parentheses run in a subshell where var1 is not recognized.
  So how could sets of conditions be grouped inside the square brackets?</p>
  
  <p>N.B. I already know the following solutions and do not want to use them:</p>
  
  <ul>
  <li>Put the conditions in separate nested if statements.</li>
  <li>Optimize/rearrange conditions in order to put them in only one set.</li>
  </ul>