shell test if empty string code example
Example: bash script check empty string
if [ -z "$var" ]
then
echo "\$var is empty"
else
echo "\$var is NOT empty"
fi
if [ -z "$var" ]
then
echo "\$var is empty"
else
echo "\$var is NOT empty"
fi