title: What's a concise way to check that environment variables are set in a Unix shell script?
body: <p>I've got a few Unix shell scripts where I need to check that certain environment variables are set before I start doing stuff, so I do this sort of thing:</p>
  
  <pre><code>if [ -z "$STATE" ]; then
      echo "Need to set STATE"
      exit 1
  fi  
  
  if [ -z "$DEST" ]; then
      echo "Need to set DEST"
      exit 1
  fi
  </code></pre>
  
  <p>which is a lot of typing. Is there a more elegant idiom for checking that a set of environment variables is set?</p>
  
  <p>EDIT: I should mention that these variables have no meaningful default value - the script should error out if any are unset.</p>