Skip to main content

if [[ -n "${variable_name/[ ]*\n/}" ]]

then

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 
Source Link
Guru
  • 431
  • 5
  • 4

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