title: Read values into a shell variable from a pipe
body: <p>I am trying to get bash to process data from stdin that gets piped into, but no luck. What I mean is none of the following work:</p>
  
  <pre><code>echo "hello world" | test=($(&lt; /dev/stdin)); echo test=$test
  test=
  
  echo "hello world" | read test; echo test=$test
  test=
  
  echo "hello world" | test=`cat`; echo test=$test
  test=
  </code></pre>
  
  <p>where I want the output to be <code>test=hello world</code>. I've tried putting "" quotes around <code>"$test"</code> that doesn't work either.</p>