var1=$(command)
var2=`command`
# To save both stdout and stderr to a variable, you need add 2>&1 at the ending.
var3=$(command 2>&1)
ref:
https://stackoverflow.com/questions/11087499/bash-how-do-you-capture-stderr-to-a-variable/11087523
var1=$(command)
var2=`command`
# To save both stdout and stderr to a variable, you need add 2>&1 at the ending.
var3=$(command 2>&1)
ref:
https://stackoverflow.com/questions/11087499/bash-how-do-you-capture-stderr-to-a-variable/11087523