To save both stdout
and stderr
to a variable:
MYVARIABLE="$(path/myExcecutable-bin 2>&1)"
Note that this interleaves stdout and stderr into the same variable.
To save just stderr
to a variable:
MYVARIABLE="$(path/myExcecutable-bin 2>&1 > /dev/null)"