title: bash function which pipes input through filter in some cases, passes input through unchanged otherwise
body: <p>I want my bash function <code>process</code> to filter input conditionally.</p>
  
  <pre><code>#!/bin/bash
  
  ARG="$1"
  
  function process
  {
      if [ "unique" == "$ARG" ];
      then
          sort | uniq
      else
          :
      fi
  }
  
  echo -e "a\na\na\nb\nc\nb\na" | process
  </code></pre>
  
  <p>If I run this with <code>bash example.sh unique</code> I get the filtered output. If I omit the <code>unique</code> argument I get <em>no</em> output. I want <code>process</code> to pass on its input <em>unchanged</em> if the <code>unique</code> argument is not given.</p>
  
  <p>What's an elegant way to do this?</p>