title: Test if a variable is set in Bash when using "set -o nounset"
body: <p>The following code exits with a unbound variable error. How can I fix this, while still using the <code>set -o</code> nounset option?</p>
  <pre><code>#!/bin/bash
  
  set -o nounset
  
  if [ ! -z ${WHATEVER} ];
   then echo &quot;yo&quot;
  fi
  
  echo &quot;whatever&quot;
  </code></pre>