title: Can a bash heredoc put its result directly into a variable?
body: <p>I have some code like this:</p>
  
  <pre><code>CMD=$(cat &lt;&lt;EOC
  docker run 
     -p $MY_IP:$LOCAL_PORT:$LOCAL_PORT -p $MY_IP:$PEER_PORT:$PEER_PORT 
     -v $CERT_DIR:/cert 
     $ETCD_IMAGE 
     --name $MACHINE.$DOMAIN 
     --peer-cert-file=/cert/server-cert.pem
     --peer-key-file=/cert/server-key.pem --peer-ca-file=/cert/ca.pem 
     --peer-addr=$MY_IP:$PEER_PORT 
     --peers=$OIPPC
  EOC
  )
  </code></pre>
  
  <p>is there a way to get a here doc to assign result directly to variable in bash without intervening process (cat)?  This code works, it just feels like too much work.</p>