title: Failure of Bash $@ variable
body: <p>I've done this several times, and it never seems to work properly. Can anyone explain why?</p>
  
  <pre><code>function Foobar
  {
    cmd -opt1 -opt2 $@
  }
  </code></pre>
  
  <p>What this is <em>supposed</em> to do is make it so that calling <code>Foobar</code> does the same thing as calling <code>cmd</code>, but with a few extra parameters (<code>-opt1</code> and <code>-opt2</code>, in this example).</p>
  
  <p>Unfortunately, this doesn't work properly. It works OK if all your arguments lack spaces. But if you want an argument with spaces, you write it in quotes, and Bash helpfully strips away the quotes, breaking the command. How do I prevent this incorrect behavior?</p>