bash if null or empty
if [ -z "$variable" ];
then echo "$variable is null";
else echo "$variable is not null";
fi
bash if null or empty
if [ -z "$variable" ];
then echo "$variable is null";
else echo "$variable is not null";
fi
bash if variable is not empty
VAR=`echo Hello world`
if [[ -n "$VAR" ]] ; then echo "Variable is set" ; fi
bash check if variable is empty
if [ -z "$var" ] #return true if $var is unset
check if a variable is null in bash
if [[ -n "$list_Data" ]]
then
echo "not Empty"
else
echo "empty"
fi
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us