How to check if null in bash
01 Feb 2010Expanding on the previous bash not null post to check if a string is null
String='' # Zero-length ("null") string variable.
if [ -z "$String" ]
then
echo "\$String is null."
else
echo "\$String is NOT null."
fi # $String is null.