how to pass multi-line output from pipe to a variable in bash? without using temp file -


i have complex grep/awk/etc command line use " $var already, makes impossible use

var="$( command )"  

to output

i don't want create temp files, make ugly,

is possible pass pipe output variable in bash

like

command   |   > $var 

just use : var=$(complex command ), writing complex command if writing on next line.

ex: if have

foo=1 bar="2 3" awk -v myfoo="$foo" -v mybar="$bar" '..... complex                                            awk                                            script here .....' 

you put var with:

foo=1 bar="2 3" var="$( awk -v myfoo="$foo" -v mybar="$bar" '..... complex                                                     awk                                                     script here .....' )" 

ie, once inside $(...), bash reading things if @ "first level". works $(...) evaluated first before line containing evaluated.