title: Why do shell script comparisons often use x$VAR = xyes?
body: <p>I see this often in the build scripts of projects that use autotools (autoconf, automake).  When somebody wants to check the value of a shell variable, they frequently use this idiom:</p>
  
  <pre><code>if test "x$SHELL_VAR" = "xyes"; then
  ...
  </code></pre>
  
  <p>What is the advantage to this over simply checking the value like this:</p>
  
  <pre><code>if test $SHELL_VAR = "yes"; then
  ...
  </code></pre>
  
  <p>I figure there must be some reason that I see this so often, but I can't figure out what it is.</p>