bash if variable is equal to null code example
Example 1: bash if null or empty
if [ -z "$variable" ];
then echo "$variable is null";
else echo "$variable is not null";
fi
Example 2: check if a variable is null in bash
if [[ -n "$list_Data" ]]
then
echo "not Empty"
else
echo "empty"
fi