The goal here is to test that a variable both exists and is not empty.
You can use the following to achieve that:
Which will expand to “x” if
THEVAR is set and not empty.
Alternatively, this test can be used:
But that test will also pass if
THEVAR is set but empty.