Tagged as: bash linux

Finding out if a variable in bash is empty or not is easy and simple, using this simple condition:

if [ -z "$variable" ]

Please note that this will also evaluate to true if the variable has not been set to any value.