title: BASH SHELL IF ELSE run command in background
body: <p>I have used the <code>&amp;</code> command before to make a script run another script in the background like so:</p>
  
  <pre><code>#!/bin/bash
  echo "Hello World"    
  script1.sh &amp;
  script2.sh &amp;
  echo "Please wait..."
  </code></pre>
  
  <p>But lets say I have another script with an IF ELSE statment and I would like to set an ELIF statement mid flow as a background task with the <code>&amp;</code> and then carry on with processing the rest of my script knowing that while rest of the ELIF will carry running in the back ground:</p>
  
  <pre><code>#!/bin/bash
  if cond1; then
     stuff
     sleep 10 &amp;
     stuff
     stuff
  elif cond2; then
     something else
  else 
     echo "foo"
  fi
  stuff
  echo "Hello World"
  </code></pre>
  
  <p>I really hope this makes sense any help would be greatly appreciated.</p>