Answers for "shell script check if string is null or 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
-1

shell cehck if string is null

my_var="nixCraft"
if [ -z "$my_var" ]
then
      echo "$my_var is NULL"
else
      echo "$my_var is NOT NULL"
fi

// https://www.cyberciti.biz/faq/bash-shell-find-out-if-a-variable-has-null-value-or-not/
Posted by: Guest on January-25-2021

Code answers related to "shell script check if string is null or empty"

C# Answers by Framework

Browse Popular Code Answers by Language