title: BASH Converting String to boolean variable
body: <p>What's the best way to convert a literal string (e.g. "True" into the appropriate bash boolean variable). For instance java has java.lang.Boolean.valueOf(String)</p>
  
  <p>Right now I'm using this in Bash:</p>
  
  <pre><code>if [ "${answers[2]}" = "TRUE" ] ; then
      clean=true; 
  else 
      clean=false; 
  fi
  </code></pre>
  
  <p>is there a way to do it and avoid the IF statement?</p>
  
  <p>edit: to clarify its not by choice that I have String variable containing "TRUE" instead of just using a boolean variable.
  for full context this is the code </p>
  
  <pre><code>ans=$(yad --title='YadExample' --form --field=Opt1:CHK FALSE  --field=Opt2:CHK FALSE --field=Opt3:CHK TRUE);
  #at this point the "yad" program is returning a string seperated by '|', e.g "TRUE|FALSE|TRUE"
  IFS="|"
  set -- $ans
  answers=( $@ )
  unset IFS
  if [ "${answers[0]}" = "TRUE" ] ; then clean=true; else clean=false; fi
  if [ "${answers[1]}" = "TRUE" ] ; then var2=true; else var2=false; fi
  if [ "${answers[2]}" = "TRUE" ] ; then var3=true; else var3=false; fi
  </code></pre>