Cloud Training (Online)




How to find if a bash variable is empty?

If you want to know if a bash variable is empty , there are multiple ways to do it and this blog post explains how to do with the recommended way.

How to determine if a bash variable is empty?

if [ -z "${VAR}" ];

The above code snippet returns trus if a variable is unset (called null in programming terms) or if it is set to empty string.