var="some_command" the output of this command is "Error writing something to blah blah"
what I want is capturing the first word "Error" and save to another variable if this variable is equal to "Error" do something.
I searched stackoverflow and googled, found some similar/same questions but didn't work for me.
var="vault capabilities secret/test/data"
#suppose the output of this command is "Error read has some problem blah" and
#I want to capture the first word (i.e. "Error" ) of this output
#and save into another variable var3
var2="echo $var | cut -d' ' -f1"
var3=`eval $var2`
$var3
$var3 prints "vault" instead of "Error"
can anyone help?