title: Bash condition of the form - [ -n "${VAR:-x}" ] gets evaluated even though VAR is set
body: <p>I have written an if statement of the form:</p>
  
  <pre><code>if [ -n "${VAR:-x}" ]; then
     #do something
     export VAR=#something
  fi
  </code></pre>
  
  <p>My shell script calls this statement twice and <strong>surprisingly</strong> passes the condition twice.</p>
  
  <p>[hint (perhaps...): This exact code is repeated in a function in an included file. The if statement is first evaluated prior to function invocation. It is "again" evaluated when the function is invoked.]</p>
  
  <p>What is the matter here? Do I understand the -x flag incorrectly?</p>
  
  <p>Thanks!</p>