Stack Exchange network consists of 183 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.
if [[ -n "${variable_name/[ ]*\n/}" ]] then #execute if the the variable is not empty and contains non space characters
else
else #execute if the variable is empty or contains only spaces fi
fi
if [[ -n "${variable_name/[ ]*\n/}" ]]
then
#execute if the the variable is not empty and contains non space characters
else
#execute if the variable is empty or contains only spaces
fi
if [[ -n "${variable_name/[ ]*\n/}" ]] then #execute if the the variable is not empty and contains non space characters else #execute if the variable is empty or contains only spaces fi