I am writing a simple ksh script. I have to check if a string is empty or not. How to do so? This is what I have :
findRes=`find . -name believe | xargs grep -q "ser"`
if [ "${findRes:-unset}" != "unset" ];then
print "${file}"
fi
empty is a string without char but defined, so in this case
[ -z "${MyVar}" ]
null is the case when your action failed, not when return empty reply
also, grep -q
could be tested with a [ $? -ne 0 ]
when search does not find the pattern