title: Pipe, standard input and command line arguments in Bash
body: <p>Consider:</p>
  
  <pre><code>command1 | command2
  </code></pre>
  
  <p>Is the output of command1 used as standard input of command2 or as command line arguments to command2?</p>
  
  <p>For example,</p>
  
  <pre><code>cat test.sh | grep "hehe"
  </code></pre>
  
  <p>What is its equivalent form without using a pipe?</p>
  
  <p>I tried</p>
  
  <pre><code>grep "hehe" $(cat test.sh)
  </code></pre>
  
  <p>and it seems not to be correct.</p>