If the variables are an empty string or uninitialized, without the x
the if
would look like this after the variable substitution:
if [ != ]; then
and thus it would fail because the operands are missing. With the x
, the if
looks like this:
if [ x != x]; then
which is syntactically valid.