How can I check if a variable is empty in Bash?
This will return true if a variable is unset or set to the empty string ("").
true
if [ -z "$MyVar" ] then echo "The variable MyVar has nothing in it." elif ! [ -z "$MyVar" ] then echo "The variable MyVar has something in it." fi