title: understanding bash "exec 1>&2" command
body: <p>I saw a bash script which had <code>exec 1&gt;&amp;2</code> command in a function. Something like:</p>
  
  <pre><code>function example()
  {
      exec 1&gt;&amp;2
      cat &lt;&lt;EOT
  Script requires at least one parameter.
  EOT
      exit 1
  } 
  </code></pre>
  
  <p>As I understand, <code>exec 1&gt;&amp;2</code> means that everything from this point one will be directed to <em>stderr</em>. Is this some sort of fixed behaviour of <em>exec</em> one needs to know by heart or is there some good explanation behind this? I mean as I understand, <em>exec</em> in Bash script just invokes a <strong>command</strong> taking the same PID which the Bash script had and once the <strong>command</strong> is finished, the PID is killed. <em>1>&amp;2</em> isn't a command. Could somebody explain the details(especially the <strong>why</strong> question) behind the <code>exec 1&gt;&amp;2</code> command?</p>