title: How do I read standard out into a bash variable without using a subshell or a named pipe
body: <p>Inside a bash script I am piping the output of a curl request to tee and then duplicating the output to many subshells. At the end of each subshell I want to assign the result to a variable declared inside my script:</p>
  
  <pre><code>#!/bin/bash
  
  token_secret=""
  token_value=""
  
  function extractTokenSecret() {
    sed -n 's/.*secret":"\([^"]*\)".*/\1/p'
  }
  
  function extractTokenValue() {
    sed -n 's/.*token":"\([^"]*\)".*/\1/p'
  }
  
  function createToken() {
    curl -v \
    -X POST \
    -s http://localhost:8080/token | tee &gt;/dev/null \
    &gt;(extractTokenSecret | [ASSIGN THE VARIABLE token_secret HERE]) \
    &gt;(extractTokenValue | [ASSING THE VARIABLE token_value HERE] \
  }
  </code></pre>
  
  <p>Any help appreciated</p>