Answers for "bash check if value not empty"

C#
13

bash if null or empty

if [ -z "$variable" ];
  then echo "$variable is null";
  else echo "$variable is not null";
fi
Posted by: Guest on April-19-2020
5

bash if variable is not empty

VAR=`echo Hello world`
if [[ -n "$VAR" ]] ; then echo "Variable is set"  ; fi
if [[ -z "$VAR" ]] ; then echo "Variable is null" ; fi
Posted by: Guest on April-12-2021

Code answers related to "bash check if value not empty"

C# Answers by Framework

Browse Popular Code Answers by Language