title: How to assign redirection symbol to a variable for assembling a command line
body: <p>I have a couple of BASH scripts that launch programs I commonly use with common arguments using variables for the command and arguments. The invocation appears at the end like so:</p>
  
  <pre><code>$PROGRAM $ARG1 $ARG2 &amp;
  </code></pre>
  
  <p>Now I want to redirect output to stderr and stdout to <code>/dev/null</code> by default. I want to be able to disable that with a switch to the script (<code>-v</code> = verbose). But if I try to assign <code>"2&gt;&amp;1 &gt; /dev/null"</code> to a var, say <code>REDIRECTION</code>, (clearing it if verbose is specified) and try to invoke like so:</p>
  
  <pre><code>$PROGRAM $ARG1 $ARG2 $REDIRECTION &amp;
  </code></pre>
  
  <p>The redirection directives are passed as arguments to the program. Is there a way to do this? Or do I have to use my solution which is to have 2 separate invocation lines, one with and one without the redirection directives, depending on "verbosity"? </p>