I've come across code that uses this syntax in an if condition:
if [ ! -z ${VARIABLE+x} ]; then
    some commands here
fi
Does it test for an non-empty variable? If so, how is it different from ! -z "$VARIABLE"?
I've come across code that uses this syntax in an if condition:
if [ ! -z ${VARIABLE+x} ]; then
    some commands here
fi
Does it test for an non-empty variable? If so, how is it different from ! -z "$VARIABLE"?
 
    
    See PARAMETER EXPANSION in man bash:
${parameter:+word}Use Alternate Value. If
parameteris null or unset, nothing is substituted, otherwise the expansion ofwordis substituted.
And few paragraphs above in the same section:
Omitting the colon results in a test only for a parameter that is unset.
