title: Using an environment variable to pass arguments to a command
body: <p>I'm trying to write a bash script that takes an environment variable and passes it along to a command.</p>
  
  <p>So if I had something like: </p>
  
  <pre><code>export OUT="-a=arg1 -b=\"arg2.0 arg2.1\""
  </code></pre>
  
  <p>I want in my bash script to do something like: </p>
  
  <pre><code>&lt;command&gt; -a=arg1 '-b=arg2.0 arg2.1'
  </code></pre>
  
  <p>I have one approach that seems to do this, but it involves using eval:</p>
  
  <pre><code>eval &lt;command&gt; ${OUT}
  </code></pre>
  
  <p>If I include <code>set -x</code> right about the command, I will see:</p>
  
  <pre><code>+ eval &lt;command&gt; a=arg1 'b="arg2.0' 'arg2.1"'
  ++ &lt;command&gt; -a=arg1 '-b=arg2.0 arg.1'
  </code></pre>
  
  <p>However, I've poked around the dangers of using eval and since this will be taking the arguments from user input, it's less than ideal.</p>
  
  <p>Since this is bash, I've also considered using arrays to store my arguments and simply put: <code>&lt;command&gt; "$ARRAY[@]"</code> to do what I want. I've been trying to use IFS, but I'm not sure what I should be splitting on.</p>