title: parse command output and save to var in bash script
body: <p>var="some_command"
  the output of this command is "Error writing something to blah blah"</p>
  
  <p>what I want is
  capturing the first word "Error" and save to another variable
  if this variable is equal to "Error" do something.</p>
  
  <p>I searched stackoverflow and googled, found some similar/same questions but didn't work for me.</p>
  
  <pre><code>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
  </code></pre>
  
  <p>$var3 prints "vault" instead of "Error"</p>
  
  <p>can anyone help?</p>