title: pass arguments to apache-ant exec task based on the variable's value
body: <p>I am only using <code>apache-ant</code> and <strong>not</strong> <code>ant-contrib</code></p>
  
  <p>I have an <code>ant</code> target</p>
  
  <pre><code>&lt;target name="stop" depends="init" &gt;
  ...
  &lt;/target&gt;
  </code></pre>
  
  <p>In which i want to invoke <code>exec</code> task. </p>
  
  <p>If the value of a variable <code>HOST_NAME</code> is <code>all</code></p>
  
  <pre><code>&lt;exec executable="${executeSSH.shell}" &gt;
      &lt;arg value="-h ${HOST_NAME}" /&gt;
      &lt;arg value="-i ${INSTANCE}" /&gt;
      &lt;arg value="-w 10" /&gt;
      &lt;arg value="-e ${myOperation.shell} " /&gt;
      &lt;arg value=" -- " /&gt;
      &lt;arg value="${INSTANCE} ${USERNAME} ${PASSWORD}" /&gt;
  &lt;/exec&gt;
  </code></pre>
  
  <p>If the value of a variable <code>HOST_NAME</code> is <code>anything else</code></p>
  
  <pre><code>&lt;exec executable="${executeSSH.shell}"&gt;
      &lt;arg value="-h ${HOST_NAME}" /&gt;
      &lt;arg value="-i ${INSTANCE}" /&gt;
      &lt;arg value="-e ${myOperation.shell} " /&gt;
      &lt;arg value=" -- " /&gt;
      &lt;arg value="${INSTANCE} ${USERNAME} ${PASSWORD}" /&gt;
  &lt;/exec&gt;
  </code></pre>
  
  <p><strong>But i would like to write only one task and not to repeat</strong><code>exec</code>. I have used <code>HOST_NAME</code> parameter but what to do about the second parameter <code>-w 10</code> which is different in both calls.</p>
  
  <p>I have tried a couple of ways by searching on SO by using <code>condition</code> and <code>if else</code> but nothing seems to be applicable for <code>exec</code> or <code>arg</code>.</p>