For debug purposes, how can I see if a variable is set in b2 ?
aka. test if a variable is defined in b2
Simply test the value of $(variable_name)-is-not-empty
:
if $(variable_name)-not-empty
{
echo "not empty" ;
}
else
{
echo "empty" ;
}
this is how assert.variable-not-empty
is implemented. It works because an undefined variable is the same as an empty list and because concatenating the string "-not-empty" to an empty list with variable expansion gives an empty list, which is equivalent to false.