if [ -z ${var+x} ]; then
echo "var is unset";
else
echo "var is set to '$var'";
fi
var
is the variable name,
To check for non-null/non-zero string variable, i.e. if set, use
if [ -n "$1" ]
if [ -n "$1" ]; then
echo "You supplied the first parameter!"
else
echo "First parameter not supplied."
fi
https://stackoverflow.com/questions/3601515/how-to-check-if-a-variable-is-set-in-bash